JAX-RS 2 print JSON request : <p>I'd like to be able to print JAX-RS 2 JSON payload from request, regardless of actual implementation on my application server.</p>

<p>I've tried suggested solutions on SO but all include binaries from actual implementation (like Jersey and similar), and I'm allowed only to use javaee-api v 7.0 in my application.</p>

<p>I've tried implementing ClientRequestFilter and ClientResponseFilter on my Client but they don't contain serialized entities.</p>

<p>Here's an example of client:</p>

<pre><code>WebTarget target = ClientBuilder.newClient().register(MyLoggingFilter.class).target("http://localhost:8080/loggingtest/resources/accounts");
Account acc = target.request().accept(MediaType.APPLICATION_JSON).get(account.Account.class);
</code></pre>

<p>And here's the implementation of MyLoggingFilter:</p>

<pre><code>@Provider
public class MyLoggingFilter implements ClientRequestFilter, ClientResponseFilter {

    private static final Logger LOGGER = Logger.getLogger(MyLoggingFilter.class.getName());

    @Override
    public void filter(ClientRequestContext requestContext) throws IOException {

        LOGGER.log(Level.SEVERE, "Request method: {0}", requestContext.getMethod());

    }

    @Override
    public void filter(ClientRequestContext requestContext, ClientResponseContext responseContext) throws IOException {
        LOGGER.log(Level.SEVERE, "Response status: {0}", responseContext.getStatus());
    }        
}
</code></pre>
