tags:

views:

32

answers:

1

How to use External Directory to Store Images.

And how i access that images thru my Web application ?

  • I am using Jboss as an application Server.
  • Web application is in Java,Jsp.
  • Presently images stored in WAR file.

After google i got the solution

C:\jboss-4.0.0\server\default\deploy\jbossweb-tomcat55.sar\server.xml

Then restart the server and access the

http://localhost:8080/contextname/images

Please provide comments

+3  A: 

I've answered similar question before: http://stackoverflow.com/questions/1812244/simplest-way-to-serve-static-data-from-outside-the-application-server-in-a-java-w

To summarize there are basically two ways:

  1. Add a new Context to the server.xml denoting the absolute location where the images are.

  2. Create a Servlet which gets an InputStream of the image using FileInputStream and writes it the usual Java IO way to the OutputStream of the response, along with at least Content-Type, Content-Length and Content-Disposition headers.

See the link for more detailed answers and code examples.

BalusC