users@jersey.java.net

Jersey returns a 404 if PathParam contains a / encoded (%2F)

From: Jean-Christophe Counio <jean-christophe.counio_at_yahoo-inc.com>
Date: Tue, 13 Jan 2009 22:13:51 +0530

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