Is the war file and the image file are in the same directory? If yes and if you are able to access the war file you should be able to access the image file as well.
Originally posted by Sudha Govindarajan:
I want to access an image file(which is outside the war file where the folder of image file is protected by credentials)from a war file where the image file and war file are located in the same server.
Anyone please help me?
Thanks in advance.
Have you tried accessing this? Are you getting any error?
What is your approach that has been attempted?
In the demo project, the files are being read with context.getResourceAsStream. You won't be able to do this if the files are outside of your web application's directory structure. You'll need to change it to use a FileReader.
This should be enough to get you on the right track.
Here's an example of a servlet which does exactly that: http://balusc.blogspot.com/2007/04/imageservlet.html
About the JSTL's c:import tag: this is not suitable either. It can only access resources in own context, or the other contexts, or just by an external (absolute) URL.