Bug 54708 - Use base file name ("ROOT") as the work directory for the default webapp instead of "_"
Use base file name ("ROOT") as the work directory for the default webapp inst...
Product: Tomcat 8
Classification: Unclassified
Component: Catalina
PC Windows XP
: P2 enhancement (vote)
: ----
Assigned To: Tomcat Developers Mailing List
Depends on:
  Show dependency tree
Reported: 2013-03-15 22:22 UTC by Konstantin Kolinko
Modified: 2013-04-23 20:06 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Konstantin Kolinko 2013-03-15 22:22:13 UTC
[1] http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Naming

There is documentation [1] on relation between context name, context path, context version and the base file name of a Context.

There is one place where Tomcat 7 does not follow [1]:
naming of javax.servlet.context.tempdir directory (aka work directory) for the application. It uses "_" for the default application.

I propose to replace that with "ROOT",
a) for consistency
b) to avoid conflict if someone deploys web application named "_", e.g. in pursue of short URLs

BTW, if someone is really facing such conflict, it could be remedied by specifying workDir attribute on a <Context>. (Though a bit hard to make the path unique without knowing the engine and host names).
Comment 1 Mark Thomas 2013-03-17 14:28:52 UTC
Nice idea. Fixed in trunk for 8.0.0 onwards.
Comment 2 Konstantin Kolinko 2013-04-08 19:15:50 UTC
Regarding r1457454 , it is not enough.

If I deploy ROOT##version, the workdir name will be "##version". For consistency I would expect "ROOT##version".

 String temp = getName();
 String temp = getBaseName();

should do the trick.
Comment 3 Mark Thomas 2013-04-23 20:06:07 UTC