• 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
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

Is it possible to create a folder on the web server from a servlet?

 
Greenhorn
Posts: 7
  • 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 folder or a file on the web server from a servlet?
If so, How can I do it ?
Thanks
 
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Creating a file or directory from a servlet is no different that creating a file from any class.
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
 
Benny Tang
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
It is possible to create the file on the file system of the web server. I think the class java.io.File can achieve this.'
Benny
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Benny T",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp.
We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please edit your profile and select a new name which meets the requirements.
Thanks.
Dave
 
Ranch Hand
Posts: 8944
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are right!

Originally posted by Benny T:
Hi,
It is possible to create the file on the file system of the web server. I think the class java.io.File can achieve this.'
Benny

 
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Megan Hill:
Is it possible to create a folder or a file on the web server from a servlet?
If so, How can I do it ?
Thanks


Hi Megan,
You surely can create a folder on the web server. But only if the folder is inside the context of the servlet. I do not think that if you are trying to create a folder outside the context you will be able to do it.
Let me know if I am correct.
-Kaustubh.
 
Sheriff
Posts: 67682
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

You surely can create a folder on the web server. But only if the folder is inside the context of the servlet.


I have no idea what is meant by this.
Eseentially, you can manipulate the file system on the server (since that is where your servlet code is running) in any way that is allowed by the file-system persmissions granted to the user under which the web server is being executed.
And as pointed out earlier, the java.io classes are the mean you would use just like any other Java program.
hth,
bear
[ August 25, 2003: Message edited by: Bear Bibeault ]
 
Saloon Keeper
Posts: 26272
186
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No contexts, sandboxes or specialized rules apply. If you can create the folder from a standalone java app - which basically means that you can create the folder from a command-line prompt, you can create the folder using java.io.File in a servlet, JSP or any other server-side code.
Your only restriction is that whatever OS filesystem security is in effect for the user and group IDs that the server runs under applies to the java code as well.
 
No matter how many women are assigned to the project, a pregnancy takes nine months. Much longer than this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic