【发布时间】:2017-06-10 17:32:35
【问题描述】:
我有一个过滤器,POST REST api 通过该过滤器,我想在过滤器中提取我的有效负载的以下部分。
{
"foo": "bar",
"hello": "world"
}
过滤代码:-
public class PostContextFilter implements ContainerRequestFilter {
@Override
public void filter(ContainerRequestContext requestContext)
throws IOException {
String transactionId = requestContext.getHeaderString("id");
// Here how to get the key value corresponding to the foo.
String fooKeyVal = requestContext. ??
}
}
我没有看到任何简单的方法可以使用 ContainerRequestContext 对象将有效负载发送到 api。
所以我的问题是如何获取与我的有效载荷中的 foo 键对应的键值。
【问题讨论】:
标签: java rest jersey jax-rs dropwizard