That is not true to my understanding. If you deploy a WAR file on Tomcat (v 4.0.3 anyway), then ServletContext.getRealPath() will return null (even though the WAR gets expanded). This is proper behavior as per the Servlet spec.
Les' message about how to get the temp path is closer, but basically I need more complete access to the file system. For the time being I have just deployed not using a WAR file and I can then, at deploy time, write the full path location into a property and use that, etc. But, what worries me is that there may be containers out there (WebLogic maybe? Resin? others?) that ONLY allow deploying as a WAR file and further, don't expand it; meaning that my normally nested file paths in the expanded WAR area are now not accessible via java.io.File. -----Original Message----- From: John Burgess [mailto:[EMAIL PROTECTED]] Sent: Monday, June 10, 2002 3:25 AM To: Tomcat Users List Subject: RE: How to write files when web-app is a WAR? If the war file is unpacked (which tomcat will do automatically at startup unless you specify somewhere in server.xml not to) then it is just as if you had deployed to the webapp\your_app directory yourself. I believe that leaving war's unpacked results in slightly worse performance and isn't recommended for a deployment server anyway. Best Wishes John Burgess [EMAIL PROTECTED] Tel: 01865 718666 Fax: 01865 718600 -----Original Message----- From: Chris Bailey [mailto:[EMAIL PROTECTED]] Sent: Friday, June 07, 2002 8:02 PM To: Tomcat Mailing List Subject: 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:[EMAIL PROTECTED] Code Intensity http://www.codeintensity.com -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.365 / Virus Database: 202 - Release Date: 24/05/02 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.365 / Virus Database: 202 - Release Date: 24/05/02 -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
