tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anto Paul <>
Subject Re: tomcat 5.5/win & loading external image files
Date Sat, 02 Apr 2005 07:09:33 GMT
On Apr 2, 2005 8:53 AM,
<> wrote:
> i need to load a bunch of image files located outside my exploded war
> file.  for example, say that the images live here
> |---c:\myimages
> |-----------\app
> |-----------------\promotions
> |-------------------------\images
> & my app is under
> |---c:\tomcat5.5
> |----------\webapps
> |--------------------\myapp.
> the img links are written out dynamically based on an init-param in the
> web.xml & javabeans.   the result is that i can get a valid path to the
> image resouce looking at the html, but cannot actually load the image.
> does anyone know if that's possible on the windows platform (win2k
> server)?
> thanks

A relative link will work if it is inside the web application root. 
    If you want to load external images write a Servlet to which the
path or name of the image file is passed as an argument and the
Servlet reads the file using ServletContext.getResourceAsStream() and
write it to the OutputStream returned by the
response.getOutputStream(). Dont forget to set the appropriate MIME
type for content type.

Anto Paul
Benchmark Softech

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message