users@jersey.java.net

Re: [Jersey] Jersey returns a 404 if PathParam contains a / encoded (%2F)

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 13 Jan 2009 18:41:21 +0100

Hi,

I have done some initial investigations and can reproduce using
embedded GF. I notice that the error page is slightly different for a
URL with %2F than for a URL that is known not to match and a 404 is
expected.

I also tested with embedded Grizzly web container and Grizzly returns
a "400 Invalid URI: noSlash" before the Servlet.service method is
invoked.

Then i tested just writing a simple servlet and using a requets URI
with %2F present and i can reproduce. Thus it is a bug in the Tomcat
and GF servers and in Grizzly.

Paul.

On Jan 13, 2009, at 5:43 PM, Jean-Christophe Counio wrote:

> Hi,
>
> I have an issue getting an encoded PathParam, Jersey (1.0.1) returns
> a 404
> Seems the same issue existed with matrixParam (https://jersey.dev.java.net/issues/show_bug.cgi?id=17
> )
> which seems to be indeed fixed. When I double encode the PathParam,
> then @GET is called and the
> PathParam decoded once.
>
> @GET
> @Path("import/{importId}/resource/{resourcePath}")
> public ImportElement getResource(@PathParam("importId") Integer
> importId,
>
> @PathParam("resourcePath") String resourcePath,
>
> @MatrixParam("matrix") String theMatrix)
> http://localhost:8080/test/v1/import/1234/resource/mytest%2Fmytest;matrix=mtest%2Fmtest
> Returns a 404
>
> http://localhost:8080/test/v1/import/1234/resource/mytest;matrix=mtest%2Fmtest
> Returns 200 with
> resourcePath=mytest
> theMatrix=mtest/mtest (So the bug on MatrixParam is indeed fixed)
>
> http://localhost:8080/test/v1/import/1234/resource/mytest%252Fmytest;matrix=mtest%2Fmtest
> Returns 200 with
> resourcePath=mytest%2Fmytest (has been decoded)
> theMatrix=mtest/mtest
>
> The problem occurs on both Tomcat 6 and Glassfish 3. I have seems a
> few mail dealing with this but I'm not
> clear about the status, it seems it works for application containers
> and not servlet containers (same thing than for MatrixParam bug)
> Thanks for your help
>
> JC
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>