You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Chris Bailey <ch...@codeintensity.com> on 2002/06/07 21:02:20 UTC

How to write files when web-app is a WAR?

>From what I've read, it seems that if you package your web application in a
WAR file, you have no way of attaining a path on the server's file system
that you can use to write files.  Reference:
http://mikal.org/interests/java/tomcat/archive/view?mesg=15006.

I have a web app that we'd like to package as a WAR.  But, we need to be
able to write various data files out to the server's file system.  What
solution(s) are people using for this?  Writing the files to a database is
not acceptable for us  (I'm not a DBMS expert, but have been told that BLOB
performance is not great, and that using a DB as a file system replacement
is not good, etc.).

I was thinking we'd have to do a bit of a hack...  Basically, at the time we
"install" our application, the user will pick the real path on their disk
where the data files are stored.  We then store this in a property in
web.xml, and retrieve that in the app for using as the path.  For
links/hrefs on a web page, we'd just use something like /data_files, but
then set up a path-mapping that had /data_files mapped to say
/home/appname/data_files or whatever.   I also am assuming I will need to
ensure that this real path lies outside of the WAR expanded directory
because someday Tomcat (and maybe others already?) will not expand the WAR
file.

Anyway, what have folks come up with?  While we use Tomcat for all our
development work, we'll likely have to support a variety of Servlet
containers (I think we can require at least Servlet 2.2, hopefully 2.3).

____
Chris Bailey       mailto:chris@codeintensity.com
Code Intensity       http://www.codeintensity.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>