Hi all,
I have some groovy page generating an image (BufferedImage), and I would
like it to be returned and displayed in browser.
I first tried to save this image as a png file with ImageIO, and it works
pretty well and image can be displayed.
If then I try to return it in http response, it always return "The image
"http://localhost/...." cannot be displayed because it contains errors".
{{velocity}}
{{groovy}}
[...]
$context.response.setContentType("image/png");
OutputStream os = $context.response.getOutputStream();
ImageIO.write(image, "jpg", os);
os.close();
[...]
{{/groovy}}
{{/velocity}}
Strangely, if I remove this previous code from my page to put back the png
file saving, png file is saved but error message still shows up ... (cache
?)
I'm asking this question here because maybe it's not the better way to
achieve this with XWiki ...
Thx for any help
--
View this message in context:
http://n2.nabble.com/Return-image-in-http-response-tp3075088p3075088.html
Sent from the XWiki- Users mailing list archive at
Nabble.com.