0

I have rest method with @javax.ws.rs.Path("/{input:.+}") in my service to accept any value for "input" pathparam. Sample code here.

@GET
@Path("/{input:.+}")
@Produces({ XML })
public Response getByInput(@PathParam("input") @Encoded String input,
                                 @Context javax.ws.rs.core.UriInfo uriInfo)

@Encoded annotation will prevent the decoding pathparam,queryparam and formparams. But in my case if the input contains

  1. %2B is getting decoded into +
  2. %2F is getting encoded into %252F.

Using SoapUI to test the rest service, here is the sample request:

Req 1: GET /rest/Ca%2B2siaeevAg9BkOLKkMmgwlZ20%3D
   the value of input = Ca+2siaeevAg9BkOLKkMmgwlZ20=
   But i am expecting Ca%2B2siaeevAg9BkOLKkMmgwlZ20%3D
Req 2: GET /rest/Ca%2F2siaeevAg9BkOLKkMmgwlZ20%3D
   the value of input = Ca%252F2siaeevAg9BkOLKkMmgwlZ20=
   But i am expecting Ca%2F2siaeevAg9BkOLKkMmgwlZ20%3D

Why this is behaving differently for %2B and %2F?

Can you please help me,i have to fix this in my project.

Lovababu Padala
  • 2,415
  • 2
  • 20
  • 28

0 Answers0