2

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

Vicky
  • 9,515
  • 16
  • 71
  • 88
  • 1
    Your question is tagged `spring`, but there's no mention of it in your description... is it a Spring MVC app? – skaffman Jan 31 '10 at 14:12

1 Answers1

3

I've answered similar question before: Simplest way to serve static data from outside the application server in a Java web application

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.

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555