2

In our project, we are using Resteasy to implement the client of a REST-API. Our code looks something like:

ResteasyClient client = ...;
ResteasyWebTarget target = client.target("api-path");
MyProxyClass proxy = target.proxy(MyProxyClass.class);

where MyProxyClass is defined like this:

public interface MyProxyClass {
    @POST
    @Path("/path")
    @Produces(MediaType.APPLICATION_JSON)
    @Consumes(MediaType.APPLICATION_JSON)
    Response myMethod(MyPayloadClass payload);
}

proxy is then used to submit requests to the REST-API, e.g.

MyPayloadClass payload = ...;
proxy.myMethod(payload);

In order to debug our application, we would like to log the exact request that RestEasy sends to the external REST-API. In particular, we would like to see the exact headers and JSON payload so that we can test the requests with an external tool like curl. Notice that, since the marshalling is done automatically / implicitly by the library, we have no access to the entities being sent with the request.

Is there such a possibility? After a lot of searching and reading in the documentation, we found no hint on how to log requests with RestEasy.

Giorgio
  • 5,023
  • 6
  • 41
  • 71
  • You can look at https://stackoverflow.com/questions/41707741/log-outgoing-jboss-eap-7-resteasy-requests – Smutje Dec 10 '20 at 08:39
  • I think [this](https://stackoverflow.com/questions/33666406/logging-request-and-response-in-one-place-with-jax-rs) fits better – fuggerjaki61 Dec 12 '20 at 11:28

0 Answers0