I need to return image from route in restlet environment, if in normal camel
environment I should be able to do
   byte[] imageData = getImage();
   HttpServletResponse response =
exchange.getIn().getBody(HttpServletResponse.class);
   response.setContentType("image/png");
   OutputStream os = response.getOutputStream();
   os.write(imageData);
   os.close();
Now, in restlet environment, the response is null. I am doing:
   exchange.getOut().setBody(imageData);
While it executed correctly, the data is encoded and inflated(about 30-40%
more), the header is set to:
   Content-Type: text/plain;charset=UTF-8
if I don't set "Content-Type", but even I set it to original type:
"image/png", the header will be
   Content-Type: image/pgn;charset=UTF-8
The returning binary data is still inflated and encoded. 
Is there any way to prevent this to happen? I guess my another question
would be:
How do I get HttpServletResponse or OutputStream for response in restlet
environment so I can simply set up and output my binary data as in normal
servlet environment? Where is it hidden(I tried to find it under debugging
environment but could not find it)?
Thanks.



--
View this message in context: 
http://camel.465427.n5.nabble.com/return-binary-image-data-in-camel-restlet-environment-tp5741062.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to