Access images outside of tomcat

Hi,

Is it possible to have a servlet access image files from a cd or external hard drive? I keep most photos within the webapp but due to size limitations some of the photos need to be moved to external media. I wan't to be able to read and report from either a DVD or an external hard drive but I'm not sure if it is possible for tomcat to read files outside of the tomcat directories.

Thanks

[414 byte] By [morningJavaa] at [2007-11-27 10:05:47]
# 1

Yes.

In the image tag you set the source url to call the servlet with the desired image as a parameter. Like

src="getImage?name=myImage"

The servlet will know where to find the image file and can the file and read in the contents.

To send the image to the browser, first set the correct content type in the response object, open the ServletOutputStream and write the image data to the stream.

tolmanka at 2007-7-13 0:41:59 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
Check here for an example: http://balusc.xs4all.nl/srv/dev-jep-img.html
BalusCa at 2007-7-13 0:41:59 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
Thanks for the help
morningJavaa at 2007-7-13 0:41:59 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...