Re: [Jersey] Jersey and url-pattern.

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Thu, 11 Feb 2010 09:40:15 +0100

Hi Damien,

When deployed to what path served to the Translator resource:





You can change the servlet URL pattern to:


and then the path served to the Translator resource will be:


If you change the @Path to @Path("/") the he path served to the
Translator resource will be


If your intension is to retain the original @Path("translate") and
serve paths as follows:


then you need to use a filter and configure the filter to "pass on"
JSP files:

        <filter-name>Jersey Filter</filter-name>
       <!-- filter paths using a regex if matched are not served by
Jersey -->
        <filter-name>Jersey Filter</filter-name>


On Feb 10, 2010, at 3:01 PM, Damian Steer wrote:

> Hi,
> I recently moved my application from jersey to 1.1.5, to
> remove the need for appengine hacks.
> I only have one resource:
> @Path("translate")
> public class Translator { ...
> My web.xml says:
> <servlet-mapping>
> <servlet-name>ServletAdaptor</servlet-name>
> <url-pattern>/translate</url-pattern>
> </servlet-mapping>
> (This is the jersey servlet container)
> In that seemed to be fine. I could GET and POST to
> translate, but / routed to my index.html and all was well.
> In 1.1.5 /translate 404s. Changing url-pattern to /* works, but it
> breaks /. Is there a way to only pass /translate to jersey?
> Thanks in advance,
> Damian
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail: