title: How to build a service which consumes an image with Jersey without using Multipart?
body: <p>I'm trying to make a service that consumes an image (binary data).</p>
  
  <p>Using this code :</p>
  
  <pre><code>@POST
  @Path("/test")
  @Consumes("image/jpg")
  @Produces(MediaType.APPLICATION_JSON)
  @RolesAllowed({ Constants.SECURITY_ROLE_ADMIN })
  public Response postRestaurantPicture(InputStream is)
  {
      System.out.println("test");
      return Response.ok("it works").build();
  }
  </code></pre>
  
  <p>Produces this error :</p>
  
  <pre><code>&lt;html&gt;&lt;head&gt;
  &lt;meta http-equiv="content-type" content="text/html;charset=utf-8"&gt;
  &lt;title&gt;415 Unsupported Media Type&lt;/title&gt;
  &lt;/head&gt;
  &lt;body text=#000000 bgcolor=#ffffff&gt;
  &lt;h1&gt;Error: Unsupported Media Type&lt;/h1&gt;
  &lt;/body&gt;&lt;/html&gt;
  </code></pre>
  
  <p>A hint is that I can't find a constant like MediaType.IMAGE_JPG like for MediaType.APPLICATION_JSON.</p>
  
  <ol>
  <li>Should I forget about consuming image/jpg or image/png directly ?</li>
  <li>Should I use multipart/form-data ?</li>
  <li>Should I use application/octet-stream and pass the image content-type in another header parameter ?</li>
  </ol>