[jsr369-experts] Re: SERVLET_SPEC-137: Allow context root

From: Mark Thomas <markt_at_apache.org>
Date: Wed, 26 Aug 2015 18:42:07 -0400

On 25/08/2015 20:53, Shing Wai Chan wrote:
> I am looking at https://java.net/jira/browse/SERVLET_SPEC-137
> (“Allow context root”)
> In Java EE ear application, one can configure the context-root in
> application.xml.
> For war, there is no such configuration in web.xml.
> Most servlet containers take default context-root = name of the
> applications.
> And there are different solutions to configure the context-root as follows:
> i) configure context-root through the proprietary descriptors.
> For instance glassfish-web.xml in GlassFish and weblogic.xml in
> WebLogic.
> ii) configure context-root at the time of deployment without editing
> descriptors in the war.
> iii) support the configuration of context-root “after” the deployment
> through administration tool.
> I am considering adding a context-root element in web.xml.
> Any comments?

I don't like it.

Web applications are meant to be independent of the context path they
are deployed to.

Containers already provide container specific ways to specify the
context path as part of the deployment process (which is where the
context path should be defined).

I'm pretty sure if this features makes it into Servlet 4.0 (and I am -1
on that happening) then Tomcat is simply always going to ignore whatever
is set.