title: Get json content of request and response on annotated Spring Controller
body: <p>I want to build a library that will save the Json content of request and response on annotated Spring controller.</p>
  
  <p>So i've build my own annotation @Foo and put it on some controllers:</p>
  
  <pre><code>    @Foo
      @RequestMapping(method = RequestMethod.POST, value = "/doSomeThing", produces = {
              MediaType.APPLICATION_JSON_VALUE, MediaType.TEXT_XML_VALUE,
              MediaType.APPLICATION_XML_VALUE})
      public ResponseEntity&lt;T&gt; doSomething(/*some parameters*/) {
          T t = doSomeJob(T.class);
          return new ResponseEntity&lt;T&gt;(t, HttpStatus.OK);
  }
  </code></pre>
  
  <p>I have no guarantee that request and response are in Contrellor's parameters!
  And i'm catching the call on any Controller  having that annotation within an @AfterReturning AOP pointcut.</p>
  
  <pre><code>@Component
  @Aspect
  public class XYInterceptor
  @AfterReturning(
              pointcut = "execution(@my.annotation.Foo)")
              public void doSomethingWithJsonContent(JoinPoint joinPoint) throws Throwable {
  
              //How can i get json value of request and response here?    
  }   
  </code></pre>
  
  <p>How can I get request and response content formatted in json (such as it is send/returned to the client) ?      </p>
  
  <p>Thanx for your help!</p>