title: IllegalStateException within method with Response paramether
body: <p>I wrote a simple class to test response reading entity method (if it works as I expect). But it didn't worked well.</p>
  
  <p>When I launch my class I get following error at <code>response.readEntity()</code>: </p>
  
  <blockquote>
  <pre><code>Exception in thread "main" java.lang.IllegalStateException: Method not supported on an outbound message.  
    at org.glassfish.jersey.message.internal.OutboundJaxrsResponse.readEntity(OutboundJaxrsResponse.java:150)
  </code></pre>
  </blockquote>
  
  <p>And here's the code I wrote</p>
  
  <pre><code>public static void main(String[] args) {
          List&lt;Entity&gt; representations = new ArrayList&lt;&gt;();
          representations.add(new Entity("foo", "baz", false));
          representations.add(new Entity("foo1", "baz1", true));
          representations.add(new Entity("foo2", "baz2", false));
          Response build = Response.ok(representations).build();
          printEntitesFromResponse(build);
      }
  
  public static void printEntitesFromResponse(Response response) {
          response
                  .readEntity(new GenericType&lt;List&lt;Entity&gt;&gt;() {})
                  .stream()
                  .forEach(entity -&gt; System.out.println(entity));
      }
  </code></pre>
  
  <p>What am I doing wrong?</p>