6

I'm writing a JAX-RS 2.0 client to send RESTful requests and process the returned responses. To aid in debugging, I would like to log the actual HTTP request sent to the server and the HTTP response returned from the server. Is there a way to do this using the JAX-RS 2.0 API (without depending on specific implementation classes)?

I've looked at JAX-RS 2.0 filtering (see "How to log request body in JAX-RS client"); however the ClientResponseFilter and ClientResponseContext Interfaces are higher level abstractions and don't give access to the actual HTTP request and response sent over the socket connection. I even briefly looked at JAX-WS logging (see Log jax-ws http request and response), but this seems to offer server logging rather than client logging.

Community
  • 1
  • 1
Geoff Alexander
  • 419
  • 5
  • 13
  • 1
    You can get some ideas from this [answer](http://stackoverflow.com/a/38459381/1426227). Adapt the filter according to your needs. – cassiomolin Aug 09 '16 at 08:04

0 Answers0