Accessing image files from several web application contexts

J

jstorta

I have a few Java web applications that I am currently working on
using JavaServer Faces.

Each of these applications needs to access the same group of image
files. I do not want to have to provide and maintain separate copies
of the image files for each web app. Nor do I want to have to put all
of the images files in the WARs each time I deploy the apps.

I want to be able to put the image files in a central place on the
server and at runtime allow each web application to access them as
needed. This central location would be inaccessible unless you went
through the web application.

For example.
I would store the images in a file system called
/web/images

The web applications, myapp1 & myapp2, would be located in
/web/apps/myapp1
/web/apps/myapp2


I have setup JNDI database connection pools and used those to access
common databases from multiple apps. What I need would be similar,
but instead of a database it would just be some directories and
files. And I do not need just the data, but I need to be able to
actually display the image on a web page generated by JSF.


A push in the right direction would be appreciated.


Thanks.
 
A

Arne Vajhøj

jstorta said:
I have a few Java web applications that I am currently working on
using JavaServer Faces.

Each of these applications needs to access the same group of image
files. I do not want to have to provide and maintain separate copies
of the image files for each web app. Nor do I want to have to put all
of the images files in the WARs each time I deploy the apps.

I want to be able to put the image files in a central place on the
server and at runtime allow each web application to access them as
needed. This central location would be inaccessible unless you went
through the web application.

For example.
I would store the images in a file system called
/web/images

The web applications, myapp1 & myapp2, would be located in
/web/apps/myapp1
/web/apps/myapp2


I have setup JNDI database connection pools and used those to access
common databases from multiple apps. What I need would be similar,
but instead of a database it would just be some directories and
files. And I do not need just the data, but I need to be able to
actually display the image on a web page generated by JSF.

A push in the right direction would be appreciated.

We can not do miracles.

If you do not need the security it is easy to put them in
a central place (you may actually get slightly better performance
by having them served by Apache than by Tomcat).

If you need the security then you need to get Tomcat involved.

If your setup allow single signon to all web apps, then you
simply create a new web app with graphics and protect that web
app but allow all users access.

If your setup requires indidual login per web app, then you
should put the grapgics in a dir that is not served by Tomcat,
but is accessible by Tomcat and then add a graphics serving
servlet to all web apps and stream the graphics file via that
(/app/GraphicsServlet?img=foobar.gif).

If your file system allows directory linking you may be able
to link the graphics dir into the web apps that need it.

Not a solution, but some ideas to work with. Maybe other have
better ideas.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top