Re: [Jersey] Explicit registration of Jersey servlet ?

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Thu, 18 Feb 2010 14:10:01 -0500

IIRC, the concern was that a JAX-RS app deployed at with a mapping of /* would hide any other content in the web application. E.g. if a developer added a JSP or a servlet it wouldn't be reachable.


On Feb 18, 2010, at 1:04 PM, Moises Lejter wrote:

> The changelog for JAX-RS 1.1 says,
> It is RECOMMENDED that implementations support the Servlet 3 framework pluggability mechanism to enable portability between containers and to avail themselves of container-supplied class scanning facilities. When using the pluggability mechanism the following conditions MUST be met:
> If no Application subclass is present the added servlet MUST be named "" and all root resource classes and providers packaged in the web application MUST be included in the published JAX-RS application. The application MUST be packaged with a web.xml that specifies a servlet mapping for the added servlet.
> Though I have to confess I think I misread this: I thought that a web application with JAX-RS resources: (1) would not need an Application class, in which case all resources would be included
> (2) would magically find a new servlet named "" added to its configuration at run time
> (3) *could* include only a <servlet-mapping> in its web.xml, for the magic entry in (2) - but would default to "/"
> Which I think is the behavior Arun expected, too. But I think my mistake was in (3) - in looking back at the quote from the changelog, it seems that there *must* be an explicit mapping in web.xml for the magic entry for the servlet in (2), even if it is just "/".
> So I am with Arun - why not default it to "/" ?
> Moises