wood burning stoves 2.0*
The moose likes Tomcat and the fly likes Storing Files Outside of Tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Storing Files Outside of Tomcat" Watch "Storing Files Outside of Tomcat" New topic
Author

Storing Files Outside of Tomcat

Andy Holm
Ranch Hand

Joined: Jul 03, 2008
Posts: 86
I would like to be able to store files that will be linked off a web page outside of the web application itself. This would allow me to redeploy without having to backup all the files first. How do I do that?
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12756
    
    5
Since servlet containers are not allowed to directly serve resources stored outside the application directory structure you will have to be indirect. Make your link point to a servlet that can use the file system to read and send the files.

Note that you will have to pay attention to setting the headers for content type and length.

Bill

Andy Holm
Ranch Hand

Joined: Jul 03, 2008
Posts: 86
Bill,

Do you have an example or a link to an example of the servlet approach that you recommend? Thanks.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60739
    
  65

http://simple.souther.us/


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
wood burning stoves
 
subject: Storing Files Outside of Tomcat
 
Similar Threads
applet not loaded
context.xml + Help Needed
Copy files from directory
Problem in running struts application
Java and Multimedia