【发布时间】:2014-05-27 22:21:48
【问题描述】:
对于以下示例(使用 Jersey 2.6),百分比编码的查询参数不会被解码,相比之下,+ 被替换为空格。
@Path("test")
public class TestResource {
@Path("/")
@GET
public void test(@QueryParam("param") String param) {
System.out.println(param);
}
}
// http://localhost:8080/test?param=hello+world // prints "hello world"
// http://localhost:8080/test?param=hello%20world // prints "hello%20world"
有什么原因,为什么只有 + 没有自动转义?有没有一种简单的方法,让所有查询参数都被完全解码,而不必在每个方法的开头都这样做?
【问题讨论】:
-
你在 websphere 上吗?
标签: java jersey jersey-2.0