On 8/6/2012 1:43 PM, Miguel Almeida wrote:
Thanks for the input regarding 2). What's the difference between using
javax.servlet.context.tempdir  vs java.io.tmpdir ?

Also, do you know the answer to 1 - ie, why did the change occur regarding
not exploding when the WAR is outside appBase?



Please don't top post. I just switched to using a real mail client and I now know why others lament so much about this.

Anyway, from the fine documentation at:

http://tomcat.apache.org/tomcat-7.0-doc/config/context.html

workDir

Pathname to a scratch directory to be provided by this Context for temporary read-write use by servlets within the associated web application. This directory will be made visible to servlets in the web application by a servlet context attribute (of type java.io.File) named javax.servlet.context.tempdir as described in the Servlet Specification. If not specified, a suitable directory underneath $CATALINA_BASE/work will be provided.

So in short, read the Servlet Specification. (This is also of type File, while the property is of type String.)

I suspect that if you use javax.servlet.context.tempdir, the scratch space will be under CATALINA_BASE/work/[Engine]/[host]/[app].

[Engine] is by default Catalina
[host] is by default localhost
[app] is your web application context name

This is different than java.io.tmpdir, which is set to CATALINA_BASE/temp.

One of the nice things about using javax.servlet.context.tempdir is that it's deleted when you undeploy your application.

Another nice thing about javax.servlet.context.tempdir is that you get a location per web application, not a location per Tomcat. This means that various contexts can't step on each other.

One of the not so nice things about javax.servlet.context.tempdir is that it normally doesn't exist outside of a servlet container or web application server. This means that if you do unit testing, you'll have to define that property when you run tests with -Djavax.servlet.context.tempdir="somewhere-i-can-write" and open this as a file (see above for comments about type).

For your answer to question 1, I guess you'll have to read any discussion on the development mailing list. Searchable archives are available online. I'm just a user, and while I casually read the development list I don't currently don't participate.

. . . just my 2 cents.
/mde/

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

Reply via email to