I have created a chart using JFreeChart inside a JSP. I want to render this chart in a webpage using JSP, without storing the image as JPEG/PNG file. This is in the google app engine environment which does not support writing to disk.
I tried the following:
java.awt.image.BufferedImage chartImage = targetChart.createBufferedImage(600,400);
ServletOutputStream out1 = response.getOutputStream();
JPEGImageEncoder encoder= JPEGCodec.createJPEGEncoder(out1);
but ended up getting a
java.lang.IllegalStateException: STREAM
BTW, java.awt is also not allowed in the app engine environment. What options do I have for solving this problem?
Just to clarify, the above JSP code is for JSP that’s specified in
<img src="...">, right?Make sure you have no spaces / new lines anywhere outside of
<% %>tags on that page, otherwise they’ll be written to JspWriter which would prevent you from obtaining OutputStream. I’m pretty sure that’s the problem you’re having now.