Currently Tomcat provides basically 2 ways to set the context path of an application. * Derived from the name of the .war or {context}.xml file. * Set the path attribute of the context element in the server.xml It would be nice if it were possible to set the path attribute in the context element of a context.xml file. I have a requirement where my application's context path must change depending upon the environment it is deployed into. Instead of renaming my .war for each environment I would prefer to set the path attribute in the context.xml of the .war to a catalina.properties property. (e.g. <context path="${contextPath}"/>) Then set the value of ${contextPath} in my catalina.properties for the different environments along with the other properties in my application that change for each environment such as database connection information. I could add a context entry in my server.xml but I'm hoping to keep application specific configuration information out of my server.xml. And from my understanding use of context element in server.xml is somewhat deprecated. If the path attribute is empty the tomcat can derive the context Path from the file name just like it does now by default. I just want to add support for the path attribute if it is specified. I'd be more than willing at taking a stab at a patch if I could get some sort of assurance that the general concept of this issue is valid.
Such a change is likely to result in unwanted double deployment for many users as well as significantly complicating the auto (un)deployment logic. Defining contexts in server.xml is not deprecated. It is discouraged for those use cases where the context could be defined outside server.xml One possible solution would be to place your war files outside of the host's appBase and use context.xml files in CATALINA_BASE/conf/Catalina/localhost. The path will be derived from the name of the xml file but the WAR file can be named whatever you like. Another solution is to disable autoDeploy and deployOnStartup for the host and explicitly define the contexts in server.xml If you need further advice on your options in this area, please ask on the users list.