[javaee-spec users] Re: "Distinct and non-overlapping" context roots

From: Bill Shannon <>
Date: Mon, 21 Mar 2016 10:59:23 -0700

Good questions. I checked with the Servlet spec lead and got these answers:

    a) Yes, those are overlapping contexts. The Servlet spec should
       probably be more clear about allowed characters.
    b) Yes, this restriction is only within the EAR. The reference
       implementation (GlassFish) imposes this for the entire server.
       The Servlet spec should probably require that.
    c) If a web module has a context root on "/", all other web
       modules in the application will conflict with it.
    d) The rule only applies for multiple web modules in an EAR file.
       As in (b), it probably should apply to the entire server.

Further discussion of these issues should probably occur on the
servlet-users mailing list [1]. You might also want to file issues
against the Servlet spec [2] to clarify the existing spec and enhance
the next version with additional requirements.

[2] wrote on 03/17/16 12:10:
> Dear EG Members,
> I'd like to get clarification in regards to the following. I am quoting
> from EE 5.0 (see link below), section 8.3.1, paragraph 3c. This
> language still exists in EE 7 and dates back to at least EE 1.3:
> The Deployer must... "Assign a context root for each web module
> included in the Java EE application. The context root is a relative
> name in the web namespace for the application. Each web module must be
> given a distinct and non-overlapping name for its context root."
> This scenario I have today:
> /context/something <-- context is /context
> /context/something/somethingelse <-- context is /context/something
> Please advise on these points:
> a) The specification puts no limitations on the context root character
> set (so it can include a slash). With that said, would you consider
> these "overlapping" contexts as the specification defines it?
> b) What does the language "web namespace for the application" really
> mean? If I take "application" to mean EAR, it sounds like this
> restriction is only within an EAR; yet I am puzzled why the restriction
> isn't meant for the entire application server.
> c) As someone else has already pointed out to me elsewhere [2], any
> context always overlaps with the ROOT context.
> d) For pure servlet containers (non-EE) like Tomcat, there is no
> "application" (EAR); thus how does the rule apply in that case?
> Please advise. Thank you.
> [1]
> [2]
> Cheers,
> Paul