0

我正在使用CXF - Rest服务。

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

我正在调用GET来自Postmanor的调用cURL,类似这样

http://localhost:8080/rest-service/search/?email=test+1@gmail.com

但是当我调试该email字段时,我将数据字段作为test 1@gmail.com. 我猜某处 URL 解码正在发生,因此+正在消失?如何将 CXF/service 配置not to alter为 URL 参数

4

1 回答 1

4

@Encoded注释添加到您的方法中,这将禁用参数的自动解码。看这里

禁用使用 QueryParam、PathParam、FormParam 或 MatrixParam 绑定的参数值的自动解码。在方法上使用此注释将禁用所有参数的解码。在类上使用此注释将禁用所有方法的所有参数的解码。

于 2015-07-21T16:33:41.710 回答