users@jersey.java.net

Re: [Jersey] Explicit registration of Jersey servlet ?

From: Moises Lejter <moilejter_at_gmail.com>
Date: Thu, 18 Feb 2010 12:04:10 -0600

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
   "javax.ws.rs.core.Application" 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 "javax.ws.rs.core.Application"
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