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=test+1@gmail.com
But when I debug the email
field, I am getting the data field as test 1@gmail.com
. 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
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.