Search code examples
javajerseyjersey-client

How can I trace out entire GET request from jersey api client call


I have the following code that calls a http GET request where I map the json result to a specific class of mine called MySpecificJsnoMappedResult.

MySpecificJsonMappedResult myResult =   
   jerseyWebResourceClient.path("stuff)
      .queryParam(“param”, “stuff”)
      <lots more query params here>
      .get(MySpecificJsonMappedResult.class);

is there an easy way via the jersey client so that can I trace out what the actual http GET call is (with params) in the case (since I'm not using a "ClientResponse" method?


Solution

  • You can configure the LoggingFilter on the client.

    client.addFilter(new LoggingFilter());
    

    You're mentioning ClientResponse, so I'm guessing you're using Jersey 1. If you're using Jersey 2, you'd use

    client.register(new LoggingFilter());