RaceBase
RaceBase

Reputation: 18848

Apache CXF - Rest URL Parameters encoding

I am using CXF - Rest service.

@GET
@Produces({"application/xml", "application/json"})
@Path("/search/")
R findUser(@QueryParam("email") String email);

I am invoking the GET call from Postman or cURL, something like this

http://localhost:8080/rest-service/search/[email protected]

But when I debug the email field, I am getting the data field as test [email protected]. I guess somewhere URL decoding is happening and because of that + is getting disappeared? How do I configure CXF/service to not to alter the URL parameters

Upvotes: 0

Views: 2387

Answers (1)

6ton
6ton

Reputation: 4214

Add the @Encoded annotation to your method which will disable the automatic decoding of parameters. See here

Disables automatic decoding of parameter values bound using QueryParam, PathParam, FormParam or MatrixParam. Using this annotation on a method will disable decoding for all parameters. Using this annotation on a class will disable decoding for all parameters of all methods.

Upvotes: 4

Related Questions