嗨,我使用jersey ContainerResponseFilter,在响应中我需要响应和请求消息,在MyApi执行并返回响应之后,mycontainerresponsefilter工作,但是当我尝试获取请求实体时,我得到了输入流关闭消息,我该如何读取输入容器responsefilter中的数据?
“实体输入流已经关闭。”
public Response MyApi(MyApiRequest request)
{
return Response.status(Response.Status.OK).entity(response).build();
}
> public void filter(ContainerRequestContext containerRequestContext,
> ContainerResponseContext containerResponseContext) throws IOException
> {
> ContainerRequest cr = (ContainerRequest)containerRequestContext;
> cr.bufferEntity();
> requestBody = (String)cr.readEntity(String.class);