This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I have the requirement to access the directory outside the build path of the web-application. So i created a context.xml file and put this file in my webapplication web-inf folder. The context file contains the docbase that point the absolute path of directory structure
Please let me know to access the resources outside the build path (like images , htmls files) what all steps i will be need
Hi I have some html files and images that are present in the build path of the web application. These files increased the size of the war file , but i want to put these files outside the build path (to other location).
So how can i access these html files and images which are outside the build path. I knew that i used file stream to access the same but is there any way to access the same means by using the context.xml file
If you want to serve up static files from outside your web application, you'll need to write a servlet that streams them.
If your servlet container is being run in conjunction with a web server like Apache HTTPD, there are ways to route only JSP/Servlet requests to the container and allow the web server to serve up the static resources. This is a lot of work to set up and maintain, just to reduce the size of a war file though.
yes Ben Souther reply is correct. but you can do that in easy way. you don't need to write new servlet. you can have static resources in another webapplication.
below steps may help you to understand better 1) Have all your jsp's in one web application,lets say 'webapp1' 2) Have your all static source(like images and css files) in another webapplication, lets say 'webapp2' have directory structure of images and css files in webapp2 like this
We're pleased to have you here with us in the Servlets forum, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.
In particular, you can use initials for your first and middle names but not for your last name (surname)