users@jersey.java.net

Re: enforce trailing slashes

From: Charles Brooking <public+java_at_charlie.brooking.id.au>
Date: Fri, 12 Nov 2010 21:56:34 +1000

On 12/11/10 21:07, Christian Helmbold wrote:
> I use @Path("directory/") with a trailing slash, but it is ignored by Jersey
> (what may be fine in many cases). Is there an easy way to enforce the trailing
> slash?

com.sun.jersey.api.core.ResourceConfig.FEATURE_REDIRECT

If true, and the path value of a Path annotation ends in a slash, the
request URI path does not end in a '/' and would otherwise match the
path value if it did, then the client is (temporarily) redirected to a
new URI that is the request URI with a '/' appended to the the end of
the path. The default value is false.

http://jersey.java.net/nonav/apidocs/latest/jersey/com/sun/jersey/api/core/ResourceConfig.html#FEATURE_REDIRECT

Later
Charlie