根据泽西岛文档 https://jersey.java.net/documentation/latest/filters-and-interceptors.html
当您想要修改任何请求或响应参数(例如标头)时,可以使用过滤器
所以我相信修改查询参数是可能的,但我不知道如何修改,而且我无法在 Google 或 stackoverflow 上找到任何内容......
这是我想实现的功能:
public class EreturnLookupFilter implements ContainerRequestFilter {
private static final Logger logger = Logger.getLogger(UserResource.class.getName());
@Override
public void filter(ContainerRequestContext requestContext) throws IOException {
// requestContext.setParameter("paramName", <new Value>);
}
}
我不热衷于使用预匹配,因为我将此过滤器链接到特定的资源方法,因此requestContext.setRequestUri( builder.build() );
按照建议here https://stackoverflow.com/questions/32939919/how-to-modify-queryparam-and-pathparam-in-jersey-2对我来说不是一个选择。
非常感谢
None
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)