• 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
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

create a directory under the servlet

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
is it possible to create a directory under the web-inf folder?

I'm to create a directory at the moment a user registers:

say login: john

than creates: web-inf/users/john

I'm using:
File newDir = new File(servlet.getServletContext().getRealPath("/WEB-INF/users/")+userDAO.getLogin()+"/");

but it does't create, when I change the dir to outside the web-inf it acepts

if its not possible, how can I create the dirs without exposing them?

thanks
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does the WEB-INF/users directory already exist?
 
Sheriff
Posts: 67695
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Mike Dikta:
is it possible to create a directory under the web-inf folder?

There is no web-inf folder; it's WEB-INF.

This is not advised. What happens if your app needs to be redeployed from its war? You should create such folders outside the bounds of the web application.
 
Mike Phillip
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Bear Bibeault:
There is no web-inf folder; it's WEB-INF.

This is not advised. What happens if your app needs to be redeployed from its war? You should create such folders outside the bounds of the web application.



and how can I protect it?


thanks guys, problem solved
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Mike Dikta:
and how can I protect it?


If it's not inside the webapp's directory stucture, it will not be directly accessible to the web.

thanks guys, problem solved


What it was?
 
Mike Phillip
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ben Souther:

What it was?



File newDir = new File(servlet.getServletContext().getRealPath("/WEB-INF/users//")+userDAO.getLogin()+"/")

I put an extra "/"
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic