POST REST APIが使用されるフィルタがあり、フィルタ内のペイロードの下の部分を抽出したい。フィルタメソッドでContainerRequestContextを使用して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キーに対応するキー値を取得する方法です。