This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Linux / UNIX and the fly likes WebApp viewing Linux folder outside app 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 » Engineering » Linux / UNIX
Bookmark "WebApp viewing Linux folder outside app" Watch "WebApp viewing Linux folder outside app" New topic
Author

WebApp viewing Linux folder outside app

Kevin P Smith
Ranch Hand

Joined: Feb 18, 2005
Posts: 362
Just wondering if anyone could help...

I need to create a Servlet that allows my webapp to view the contents of a folder that is outside of the webapp's structure on a Linux machine.

If I was doing this on Windows I would probably just provide the absolute path C:/myfolder so the webapp knows to look in here.
How would I do this for a folder under Linux in a loction like: /usr/local/myfolder ?

If it just give it the path /usr/local/myfolder then the webapp will try to find the folder under the ROOT path

Cheers!
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8836
    
    7

Keith SmithA wrote: then the webapp will try to find the folder under the ROOT path


Sure. The root directory is the top-level directory "/". The full path /usr/local/myfolder should work. Of course, you have to make sure that the user running the web server has permission to view the files in "myfolder" and there are no security policies that would prevent access (Tomcat, for instance, has a policy that limits access to files and directories under $TOMCAT_HOME/webapps).


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
 
wood burning stoves
 
subject: WebApp viewing Linux folder outside app
 
Similar Threads
How can we host a jsp in unix web server
Editing the bashrc file
SFTP from java
Uploading images to webapp/images folder
I've downloaded eclipse for linux. Now how do I start it?