tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Crowther" <>
Subject RE: Specifying relative path for TOMCAT 5.5 ?
Date Thu, 01 Mar 2007 13:32:04 GMT
> From: Rajendra Sakpal [] 
> 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

		- Peter

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message