tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stéphane BAUDET <>
Subject Re: How to get around a tricky situation.
Date Wed, 04 Apr 2001 07:47:56 GMT

You could also create a new "empty" context called /images with docbase
properly set to the location of your images. This context will serve
your images.

Jacob Kjome a écrit :
> the loading of images is a function of your browser after the page has been
> sent by the server to it.
> The only way I can think of doing this (barring some funky Java class
> like  ReturnImagesFromContextInterceptor.class, which I'm not sure how
> you'd do?) is to prefix all your /images/ references with the name of the
> current context, so instead of  /images/myimage.gif, you would do
> /myWebApp/images/myimage.gif
> If you didn't want to hardcode these to your context, you could put the
> context in dynamically based on a variable in your servlet or, before
> sending the stream back, look for any /images/ references and to a replace
> with the correct path.  Not sure how to do that, offhand, but I'm quite
> sure it can be done.
> Jake
>  >Hi, I need some advice on how I might fix a problem with one of our web
> apps. We farmed out an app that works ok except that the web pages which
> are >created by servlets are looking for images in the tomcat root images
> directory. This presents a problem in that if I create a war of our app I
> also have to >distribute and copy the images over to the root images
> directory. Can I set up my web.xml file so that when a web page looks for
> an image in the /images >directory it actually pulls them out of my
> myWebApp/images directory. What I am trying to achieve is one war file that
> I can use to distribute our app without >having the customer copy images
> over to the root/images directory. Thanks for any help. Regards Alex Colic-0132


Stéphane BAUDET

GL Trade
48, rue Notre Dame des Victoires - 75002 Paris
Tel : 01 53 40 43 12 (interne 1312)
Fax : 01 53 40 01 40
Email :

View raw message