jsr369-experts@servlet-spec.java.net

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

From: Stuart Douglas <sdouglas_at_redhat.com>
Date: Wed, 26 Aug 2015 22:36:37 -0400 (EDT)

I like the idea. At the moment there is no standard way to do this unless your way is deployed in an ear.

I don't really think the arguments against it have any weight, if a container specific mechanism is also used then it will just override the name in web.xml (same as what happens anyway for the default name). Just because it is not the ideal approach for every situation does not mean that we should not offer it at all.

An obvious example of where this would be useful is the default artefact name that maven generates, ${artefact}-${version}.war, at the moment there is no standard way to change the context path to not include the version number.

Stuart

----- Original Message -----
> From: "Shing Wai Chan" <shing.wai.chan_at_oracle.com>
> To: jsr369-experts_at_servlet-spec.java.net
> Sent: Thursday, 27 August, 2015 4:08:36 AM
> Subject: [jsr369-experts] Re: SERVLET_SPEC-137: Allow context root
>
> The usage of context.xml mentioned below is similar to case (iii) below.
>
> The proposed <context-root> in web.xml provides a context-root for the
> application.
> (We can clarify that the default context-root is name of the application
> if <context-root> is not present in the web.xml.)
> This can still be overridden by (ii) and (iii) below if it is necessary.
>
> Shing Wai Chan
>
> On 8/25/15, 6:20 PM, Justin Lee wrote:
> > I think web.xml is probably not the *greatest* place for that. It's a
> > static resource embedded in the deployment artifact that people would
> > have to explode to change and then rebundle. I've seen (and used)
> > context.xml, e.g., to allow for simultaneous deployments of wars. I
> > haven't found matching war names to context roots is really a problem
> > for single deployments.
> >
> > On Tue, Aug 25, 2015 at 8:53 PM, Shing Wai Chan
> > <shing.wai.chan_at_oracle.com <mailto:shing.wai.chan_at_oracle.com>> 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?
> >
> > Shing Wai Chan
> >
> >
> >
> >
> > --
> > You can find me on the net at:
> > http://antwerkz.com <http://antwerkz.com/> http://antwerkz.com/+
> > http://antwerkz.com/twitter http://antwerkz.com/github
>