| Author |
create a directory under the servlet
|
Mike Phillip
Ranch Hand
Joined: Dec 05, 2007
Posts: 37
|
|
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
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
|
Does the WEB-INF/users directory already exist?
|
Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56179
|
|
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.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Mike Phillip
Ranch Hand
Joined: Dec 05, 2007
Posts: 37
|
|
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
Joined: Dec 11, 2004
Posts: 13410
|
|
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
Joined: Dec 05, 2007
Posts: 37
|
|
Originally posted by Ben Souther: What it was?
File newDir = new File(servlet.getServletContext().getRealPath("/WEB-INF/users//")+userDAO.getLogin()+"/") I put an extra "/"
|
 |
 |
|
|
subject: create a directory under the servlet
|
|
|