title: jax-rs Jersey @Post Response entity is empty
body: <p>I'm trying to @POST a user-created object and get a Response with a different user-created payload as the entity.  Although the object returned exists and is populated, on the client end it is empty.</p>
  
  <p>Client sent / server received object:</p>
  
  <pre><code>@XmlRootElement
  public class TweetQuery {
      String query;
      List&lt;TweetQueryTweet&gt; tweets = new ArrayList&lt;&gt;();
      // setters and getters
  }
  
  public class TweetQueryTweet {
      private String id;
      private String text;
      // setters and getters
  }
  </code></pre>
  
  <p>Server received / client sent object:</p>
  
  <pre><code>@XmlRootElement
  public class TweetClusters {
      List&lt;TweetCluster&gt; tweetClusters = new ArrayList&lt;&gt;();
      // setters and getters
  }
  
  public class TweetCluster {
      List&lt;String&gt; labels = new ArrayList&lt;&gt;();
      List&lt;String&gt; docs = new ArrayList&lt;&gt;();
      // setters and getters
  }
  </code></pre>
  
  <p>Client (Arquillian) Test:</p>
  
  <pre><code>@Test
  @RunAsClient
  public void test01SeeSomething(@ArquillianResource URL deploymentUrl) throws ... {
  
      final URI targetURI = ...;
      System.out.println("    test target:" + targetURI.toASCIIString());
  
      Entity&lt;TweetQuery&gt; tweetQuery = Entity.entity(getTestTweetQuery(), MediaType.APPLICATION_JSON);
  
      Client client = ClientBuilder.newBuilder().build();
      WebTarget target = client.target(targetURI.toASCIIString());
  
      Response response = target.request(MediaType.APPLICATION_JSON).post(tweetQuery);
  
      TweetClusters x = response.readEntity(TweetClusters.class);
      System.out.println("Entity:" + x);
      System.out.println("Response: " + response.getStatus());
      assertEquals(Status.OK.getStatusCode(), response.getStatus());
      assertNotNull(x);
      assertThat(x.getTweetClusters().size()).isGreaterThan(0);
  }
  </code></pre>
  
  <p>Jersey Post method:</p>
  
  <pre><code>@POST
  @Consumes(MediaType.APPLICATION_JSON)
  @Produces(MediaType.APPLICATION_JSON)
  public Response clusterPost(TweetQuery tweetQuery) {
      TweetClusters tweetClusters = clusterService.getTweetClusters(tweetQuery);
      System.out.println("clusterPost - in - tweetQuery: " + tweetQuery);
      System.out.println("    - out tweetClusters: " + tweetClusters);
      return Response.status(Status.OK).type(MediaType.APPLICATION_JSON).entity(tweetClusters).build();
  }
  </code></pre>
  
  <p>Debug:</p>
  
  <pre><code>test target:http://localhost:18080/test//cluster
  
  clusterPost - in - tweetQuery: [TweetQuery - query:TweetQuery query, tweets:[[TweetQueryTweet - id:1, text:text 1], [TweetQueryTweet - id:2, text:text 2], [TweetQueryTweet - id:3, text:text 3]]]
      - out tweetClusters: [TweetClusters:[[TweetCluster - labels: [Other Topics], docs:[3, 2, 1]]]]
  Entity:[TweetClusters:[]]
  Response: 200
  </code></pre>
  
  <p>Line 2 - clusterPost - in -- shows TweetQuery is being marshalled properly.
  Line 3 - clusterPost - out -- shows the tweetClusters to be sent as the Response entity exists
  Line 4 - tweetClusters is not coming out of the request</p>
  
  <hr>
  
  <p><strong>Edit</strong></p>
  
  <p>I changed the REST method to return the tweetQuery that it receives as input and it is returned correctly.  So its something about TweetClusters.  Maybe I need a MessageBodyReader &amp; Writer.  Or a Moxy @XmlJavaTypeAdapter.  But for what as Lists obviously work out of the box as TweetQuery works.  </p>
  
  <p><a href="https://stackoverflow.com/users/383861/blaise-doughan">https://stackoverflow.com/users/383861/blaise-doughan</a> are you out there? :)</p>
  
  <p>Am I missing something simple?</p>