title: How to return a PNG image from Jersey REST service method to the browser
body: <p>I have a web server running with Jersey REST resources up and I wonder how to get an image/png reference for the browsers img tag; after submitting a Form or getting an Ajax response. The image processing code for adding graphics is working, just need to return it somehow.</p>
  
  <p>Code:</p>
  
  <pre><code>@POST
  @Path("{fullsize}")
  @Consumes(MediaType.MULTIPART_FORM_DATA)
  @Produces("image/png")
  // Would need to replace void
  public void getFullImage(@FormDataParam("photo") InputStream imageIS,
                           @FormDataParam("submit") String extra) {
  
        BufferedImage image = ImageIO.read(imageIS);
  
        // .... image processing
        //.... image processing
  
        return ImageIO.  ..  ?
  
  }
  </code></pre>
  
  <p>Cheers</p>