users@jersey.java.net

[Jersey] Re: Resources only available if I add a trailing slash - Jersey-Guice-Tomcat configuration

From: Christopher Piggott <cpiggott_at_gmail.com>
Date: Sat, 5 May 2012 23:09:07 -0400

I changed it from serve("*").with(GuiceContainer.class) to
filter("/*")..through(GuiceContainer.class) and now it works. Should
that have fixed it?



On Sat, May 5, 2012 at 10:49 PM, Christopher Piggott <cpiggott_at_gmail.com> wrote:
> Hi,
>
> With Jersey 1.12 and Tomcat 7, when I get a resoruce like this:
>
> @Path("/something")
> public class SomeResource {
>  @GET
>  public String someMethod() { return "hi"; }
> }
>
> when I try to do this, it only works if I
>
>   GET /webAppRoot/something/
>
> but NOT if I
>
>   GET /webAppRoot/something
>
> I have been trying to track this down.  Web.xml looks like this:
>
>        <listener>
>                <listener-class>com.autofrog.live.ServletConfig</listener-class>
>        </listener>
>
>        <filter>
>                <filter-name>guiceFilter</filter-name>
>                <filter-class>com.google.inject.servlet.GuiceFilter</filter-class>
>        </filter>
>
>        <filter-mapping>
>                <filter-name>guiceFilter</filter-name>
>                <url-pattern>*</url-pattern>
>        </filter-mapping>
>
>
> and the module's configureServlets() ends in:
>
>                serve("*").with(GuiceContainer.class, params);
>
>
> Any ideas on what could be going wrong here?
>
> --Chris