Play 2.5: get response body in custom http action
<p>I'm trying to create a custom http action (<a href="https://playframework.com/documentation/2.5.x/JavaActionsComposition" rel="nofollow">https://playframework.com/documentation/2.5.x/JavaActionsComposition</a>) to log request and response bodies with Play 2.5.0 Java. This is what I've got so far:</p>

<pre><code>public class Log extends play.mvc.Action.Simple {

    public CompletionStage&lt;Result&gt; call(Http.Context ctx) {
        CompletionStage&lt;Result&gt; response = delegate.call(ctx);
        //request body is fine
        System.out.println(ctx.request().body().asText())
        //how to get response body string here while also not sabotaging http response flow of the framework?
        //my guess is it should be somehow possible to access it below?
        response.thenApply( r -&gt; {
            //???
            return null;
        });
        return response;
    }

}
</code></pre>