title: Logging response body (HTML) from HttpServletResponse using Spring MVC HandlerInterceptorAdapter
body: <p>I am trying to log (just to console write now for simplicity sake) the final rendered HTML that will be returned by the HttpServletResponse. (i.e. the body) To this end, I am using the HandlerInterceptorAdapter from Spring MVC like so:</p>
  
  <pre><code>public class VxmlResponseInterceptor extends HandlerInterceptorAdapter {
      @Override
      public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
          System.out.println(response.toString());
      }
  }
  </code></pre>
  
  <p>This works as expected and I see the HTTP response headers in the console. My question is if there is a relatively simple way to log the entire response body (i.e. final rendered HTML) to the console without having to resort to doing jumping jacks with PrintWriters, OutputStream's and the like.</p>
  
  <p>Thanks in advance.</p>