Klaodeli
04-06-2010, 00:27
Creo un immagine dinamicamente, poi la vorrei scrivere sulla response e leggerla dal jsp. Ho provato questo codice: (chartImage è l'immagine sotto forma di BufferedImage)
Nella sevlet:
byte[] byteImage = enc.encode(chartImage, "JPEG");
response.setContentType("image/jpeg");
response.setContentLength(byteImage.length);
response.getOutputStream().write(byteImage);
quindi ho scritto nel response un "byte[]"
ma mi da questo errore:
HTTP Status 500 -
type Exception report
message
descriptionThe server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: java.lang.IllegalArgumentException: Unsupported image format - JPEG
root cause
java.lang.IllegalArgumentException: Unsupported image format - JPEG
note The full stack traces of the exception and its root causes are available in the GlassFish v3 logs.
1. Dove sbaglio?
2. In ogni caso come faccio a recuperare questa immagine dalla pagina jsp?
Nella sevlet:
byte[] byteImage = enc.encode(chartImage, "JPEG");
response.setContentType("image/jpeg");
response.setContentLength(byteImage.length);
response.getOutputStream().write(byteImage);
quindi ho scritto nel response un "byte[]"
ma mi da questo errore:
HTTP Status 500 -
type Exception report
message
descriptionThe server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: java.lang.IllegalArgumentException: Unsupported image format - JPEG
root cause
java.lang.IllegalArgumentException: Unsupported image format - JPEG
note The full stack traces of the exception and its root causes are available in the GlassFish v3 logs.
1. Dove sbaglio?
2. In ogni caso come faccio a recuperare questa immagine dalla pagina jsp?