aspose file tools *
The moose likes Servlets and the fly likes Filesystem access from servlet or not Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Filesystem access from servlet or not" Watch "Filesystem access from servlet or not" New topic
Author

Filesystem access from servlet or not

Michael Laufer
Greenhorn

Joined: May 30, 2002
Posts: 29
Hi,

I am just thinking about file system access from my servlet. Is it better to load my deplyoed properties files via the classloader or via a File object? Are there any reasons, i.e. security, that are related to this issue? What is the specification saying about this issue?

Any help is really appreciated.

Thanks in advance & kind regards, Michel
Eddy Lee Sin Ti
Ranch Hand

Joined: Oct 06, 2005
Posts: 135
Read this: Smartly load your properties

Usually in servlets, you can use ServletContext.getResource(), getResourceAsStream() to load resources in that particular context.


SCJP, SCWCD, SCJWS, IBM 700,IBM 701, IBM 704, IBM 705, CA Clarity Technical<br /> <br /><a href="http://eddyleesinti.blogspot.com" target="_blank" rel="nofollow">http://eddyleesinti.blogspot.com</a>
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Definitely load it as a Stream rather than accessng it as a File, since you can't get a File reference if you pack it in a JAR
 
 
subject: Filesystem access from servlet or not