title: Retrieve an image from RESTlet API
body: <p>I am creating a REST API in JAVA using RESTlet 2.0.  I want to create an API call that will return an image from the database in a similar way as Facebook is doing in its Graph API.</p>
  
  <p>Basically, I will do a <strong>GET</strong> to e.g.</p>
  
  <pre><code>    http://localhost:8080/myAPI/{session_id}/img/p?id=1
  </code></pre>
  
  <p>This will then retrieve the blob data from the DB and then return the image in such a way that the user can display it like this:</p>
  
  <pre><code>    &lt;img src="http://localhost:8080/myAPI/{session_id}/img/p?id=1"&gt;
  </code></pre>
  
  <p>I know that I will probably need to set the content-type in the header to Image/PNG (assuming the image is a PNG of course), but what I'm struggling with is returning the data correctly for this to work.</p>
  
  <p>Any suggestions?</p>
  
  <p>Thanks!</p>