• Post Reply Bookmark Topic Watch Topic
  • New Topic

Jersey RESTresponse message body  RSS feed

 
kri shan
Ranch Hand
Posts: 1489
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to print response message body as a String within filter method and tried couple of response methods (getEntityOutputStream() / getEntity() / GetContainerResponseWriter() )



public class Test implements ContainerRequestFilter , ContainerResponseFilter) {

@Override
public ContainerResponse filter(ContainerRequest request, ContainerResponse response) {
response.
}

}
 
kri shan
Ranch Hand
Posts: 1489
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any update ?
 
Ron McLeod
Saloon Keeper
Posts: 1601
232
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should be looking at creating an interceptor rather than a filter. Here's a quick example using FilterInputStream to get in the middle of the input stream. There are probably better ways to do this.

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!