title: How to read a response from a web service that returns a byte[]
body: <p>I've got this code of my web service:   </p>
  
  <pre><code>    @GET
      @Produces(MediaType.APPLICATION_JSON)
      public static Response fillData(final Map&lt;String, Object&gt; data, final   String name, @Context final ServletContext context) {  
         ...  
         final byte[] file = ...
         return Response.ok(file).build();
  </code></pre>
  
  <p>How can I read the response in my client?</p>
  
  <pre><code>final javax.ws.rs.core.Response reponse = client.target(URL_REST).path("/path").request(MediaType.APPLICATION_JSON).get();
  </code></pre>
  
  <p>This is totally wrong (ByteArray doesn't exist), but I want to do something like it:</p>
  
  <pre><code>byte[] pdfByteArray = reponse.readEntity(ByteArray.class);
  </code></pre>
  
  <p>How can I do? </p>