tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Glen Mazza <grm7...@verizon.net>
Subject Re: writing files with a web application
Date Mon, 23 Jan 2006 14:39:56 GMT
Peter Crowther wrote:

>>From: SOA Work [mailto:soawork@web.de] 
> 
> 
> Check the Servlet Spec (version 2.4 is at
> http://www.jcp.org/aboutJava/communityprocess/final/jsr154/
> ) for questions of this kind.
> 
>>>From memory in both cases (so treat with caution):
> 
> 
>>1.) am I allowed to call main methods or programms in my web 
>>applicatio?
> 
> 
> If you wish to be spec-compliant, no.  However, it should work depending
> on Tomcat's security settings.
> 

Really?  I thought you could do anything within a Servlet that you can 
do within normal Java code.  Also, a restriction on calling the "main()" 
method within a class seems nonsensical, because one can simply rename 
that method.


> 
>>2.) am I allowed to write files on the disk from within an 
>>web application? If I am, something went wrong while trieing ;-)
>>Can i write anywhere or have I to write to my application dir 
>>or to temp dir or something.
> 
> 
> 
> If you wish to be spec-compliant, you can only write to a temporary
> directory that you ask the context for.  However, this may or may not be
> enforced depending on Tomcat's security settings.
> 

This point I'm less sure on, but I would think it's the role of the 
*servlet container* to be spec-compliant, not the programmer of a 
servlet.  But FWIW, the Tomcat Administration Web Application (separate 
download in 5.5.x[1]) does alter the XML files located in the Tomcat 
/conf directory.  If the original questioner is having problems altering 
text files located on the server, perhaps the code for the Admin 
application would be a good reference for him.

Glen

[1] http://tomcat.apache.org/download-55.cgi


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message