tags:

views:

159

answers:

3

I have two web applications running in the same Tomcat Instance. In one of these applications the user will have the ability to upload files such as images and pdf files. I would like the uploaded files to be available to the second application.

Is there a best practice for such a scenario? Or just a pointer to a technology would be fine.

I considered using web services but wondered if it was overkill.

Thanks Vincent

A: 

You could shove the files into a shared database... this also lets you store meta data along with them.

danb
+2  A: 

I'd say it depends on how robust you need the file storage to be, and how transactional. The simplest way would be a shared directory that's on the classpath of both apps. A database would be a more robust, but more complex, solution.

David M. Karr
+3  A: 

Cheap, bad answer - have both applications softlink to a shared directory. This has the benefit of being stupid-simple to do but has evil transactional-type issues. Since you say that only one application is changing the data, and the other is read-only you might be able to get away with it, as long as the second app can't observe files in a partially created state.

Using a db is transactionally safe but is going to be pretty unpleasant as the files get larger.

Steve B.
This was the original idea. I would hate to put images into a database. I think transactional issues are at a minimum in the given scenario. So a shared directory it is.
Vincent Ramdhanie