users@jersey.java.net

Re: [Jersey] ServletContainer and relative path resolution

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Wed, 06 Aug 2008 10:13:36 +0200

Hi Ryan,

For Web app deployment Jersey does not have much choice in the matter
and it cannot override the standard Servlet behavior.

However, can use either "/" or "/*" for the servlet URL pattern.

Paul.

Ryan Heaton wrote:
> Hello.
>
> I was surprised to find that the paths to the resource classes are
> resolved relative to the servlet path. Is there a way to override
> this behavior?
>
> For example, if my servlet mapping is defined like this (standard
> petclinic example)
>
> <web-app>
> ...
> <servlet-mapping>
> <servlet-name>jersey</servlet-name>
> <url-pattern>/clinic/*</url-pattern>
> </servlet-mapping>
> ...
> </web-app>
>
> And my resource class:
>
> @Path("/clinic/")
> public class Clinic {
> ...
>
> @Path("owner/{id}")
> public Owner getOwner(@PathParam( "id" ) String id) {
> ...
> }
> }
>
> Then the "owner" method will be mounted at "/clinic/clinic/owner/id".
> I guess I expected paths to be resolved relative to the servlet
> context path, rather than the context path + servlet path. I'd like
> to define my web.xml file to be narrow so as to allow the default
> servlet to handle things like jsp pages and static files.
>
> Thanks!
>
> -Ryan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>

-- 
| ? + ? = To question
----------------\
    Paul Sandoz
         x38109
+33-4-76188109