Set verbose mode

Verbose mode is used to trace all requests and responses.

You have the option to log just headers or bodies or both.

client.setVerboseMode( HttpDebugLevel.HEADERS );

This way you will see logs similar to:

INFO  12:44:09 http.HttpClient: Sending the following requests :
      POST /examples/servlets/servlet/RequestHeaderExample HTTP/1.1
      Content-Length: 12
      Content-Type: application/json
      Host: 10.10.10.10:8080
      Connection: Keep-Alive
      User-Agent: Apache-HttpClient/4.3.1 (java 1.7)
      Accept-Encoding: gzip,deflate


INFO  12:44:10 http.HttpClient: Receiving the following response :
      HTTP/1.1 200 OK
      Server: Apache-Coyote/1.1
      Content-Type: text/html
      Content-Length: 883
      Date: Mon, 24 Aug 2015 09:46:44 GMT

 


Using a proxy

Here are the details. Same for both HttpClient and RestClient.

 


Back to parent page

Go to Table of Contents