开发者

How to use ExternalDirectory Resource

开发者 https://www.devze.com 2022-12-18 10:14 出处:网络
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.

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

htt开发者_JS百科p://localhost:8080/contextname/images

Please provide comments


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号