tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Crowther" <Peter.Crowt...@melandra.com>
Subject RE: Specifying relative path for TOMCAT 5.5 ?
Date Thu, 01 Mar 2007 13:32:04 GMT
> From: Rajendra Sakpal [mailto:rajendrasakpal.mailinglist@gmail.com] 
> What is the right way to make Tomcat write a file in the directory
> : "/webapps/Jonathon/WEB-INF/etc/subscriber.txt" ?

Use servletContext.getRealPath("/WEB-INF/etc/subscriber.txt").  However,
you should not be writing files in your webapp directory; you are not
guaranteed write access to it by the servlet spec.  For example, your
webapp may not be unpacked, so the WEB-INF directory is inside the .war
file.  If you need to persist data, write to a database or (if you have
to) write to some filestore that you define via a configuration option
somewhere.

		- Peter

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


Mime
View raw message