Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

WebApp viewing Linux folder outside app

 
Kevin P Smith
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9319
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic