title: CXF REST: How can I retrieve the POJO object from the message in an interceptor before it gets marshal'd?
body: <p>We have implemented a REST API in CXF. My goal is to be able to define custom annotations on a POJO and process them in a CXF interceptor before they get marshal'd. I believe I have all the information I need to be able to do this except for retrieving the actual object in the interceptor. My code looks like this:</p>
  
  <ol>
  <li><p>Resource class</p>
  
  <pre><code>@Path("/mypath")
  public class MyResource {
  
      @GET
      public MyObject getObject() {
         MyObject o = new MyObject();
         ...
         return o;
      }
  }
  </code></pre></li>
  <li><p>MyObject</p>
  
  <pre><code>public class MyObject {
  
      private String x;
  
      @MyAnnotation
      public String getX() {
         return x;
      }
  
      public String setX(x) {
         this.x = x;
      }
  }
  </code></pre></li>
  <li><p>Interceptor</p>
  
  <pre><code>public class MyInterceptor extends AbstractPhaseInterceptor&lt;Message&gt; {
  
      public VersionOutInterceptor() {
          super(Phase.POST_LOGICAL);
      }
  
      public final void handleMessage(Message message) {
          // 1. STUCK -- get object from the message
          // 2. parse annotations and manipulate the object
          // 3. put the object back on the message for serialization
      }
  }
  </code></pre></li>
  </ol>
  
  <p>How do I get the object from the message, manipulate it based on the annotations, and put it back on the message?</p>