users@jersey.java.net

Re: [Jersey] Trailing slash on root resource

From: Charles Brooking <public_at_charlie.brooking.id.au>
Date: Fri, 22 May 2009 10:52:23 +1000 (EST)

G'day,

> OK, got it now, and can reproduce it. Hmm.... strictly speaking the
> path if the servlet pattern is /foo/* and the full path is /context/
> foo then the servlet should not match, plus there is inconsistent
> behavior with the "/*" and /foo/*" patterns, sigh...

Section SRV.11.2.2 of the Servlet 2.4 spec says that an incoming path /baz
will match the pattern /baz/* (it's an example in the table).

We have talked about using redirects - and this is what Tomcat and
Glassfish do for the /contextPath case - but my experience with non-root
resources in Jersey like @Path("/foo/{foo}/") indicate that a 200 response
is returned both with and without the trailing slash. So if we want
consistency with non-root resources in the Jersey servlet maybe we should
return 200 instead of redirecting.

> Could you log an issue to as a reminder to change this to redirection?

https://jersey.dev.java.net/issues/show_bug.cgi?id=297

Later
Charlie