File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Spring in Action this week in the Spring 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: 12803
    
    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: 61415
    
  67

http://simple.souther.us/


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Storing Files Outside of Tomcat