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
.