Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Can I write to a directory outside the j2ee container?

 
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want my servlet to write to the equivalent of C:\store, however, because I'm using Linux, I want to write to /store. I have tried adding
<virtual-directory virtual-path="/store" real-path="/store/" />
and
<virtual-directory virtual-path="/store" real-path="~//store/" />
and
<virtual-directory virtual-path="/store" real-path="/../../../../../store/" />
to {OC4J_HOME}/j2ee/home/application-deployments/myApp/myApp/orion-web.xml with no success. The webapp still tries to write to
{OC4J_HOME}/j2ee/home/store

Can I write outside the j2ee container?
 
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes.
Make sure to use the File class static fields separator and pathSeparator (or the char versions).
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you can indeed, IF the application server allows it (many don't or can have file permissions outside the web application directory disallowed for security reasons).
 
I was her plaything! And so was this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic