Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Servlets and the fly likes Servlets and File I/O Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlets and File I/O" Watch "Servlets and File I/O" New topic

Servlets and File I/O

John R Roberts
Ranch Hand

Joined: Dec 27, 2006
Posts: 36
Hi all,
I am developing an application that will run in a clustered application server. My app will have message driven beans and session beans. Now I know that you should not have any file I/O in that environment and that is fine. The question is that if I have servlets running within that application aswell can I safely let the servlet access the file system to read or write files.

Deepak Bala

Joined: Feb 24, 2006
Posts: 6662

Your servlets should have no problem accessing the file system. As long as you dont let EJBs do the IO work it should work

SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13037
Note that Java provides very fine control over the IO allowed by a web application. For example in Tomcat, with security turned on, a servlet can be allowed to read/write etc in only one specific directory location.

I agree. Here's the link:
subject: Servlets and File I/O
It's not a secret anymore!