[jboss-user] [JBoss Seam] - Re: File(data) Download problem...
jazir1979
do-not-reply at jboss.com
Fri Mar 2 00:03:00 EST 2007
Hi,
I'm doing something similar to you for exporting jasper reports (JasperPrint) objects to various output formats.
I think perhaps you are missing the call to FacesContext.responseComplete(), but I will show you all of my code, because there are also various flush() and close() calls in there which I found were necessary...
| final HttpServletResponse response =
| (HttpServletResponse) context.getExternalContext().getResponse();
| final OutputStream responseStream = response.getOutputStream();
| response.setContentLength(stream.size());
| response.setContentType(contentTypes.get(outputType));
| if (outputType != ReportOutputType.HTML) {
| response.setHeader("Content-Disposition", "attachment; filename=report." + outputType);
| }
| responseStream.write(stream.toByteArray());
| responseStream.flush();
| responseStream.close();
| response.flushBuffer();
| context.responseComplete();
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4024540#4024540
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4024540
More information about the jboss-user
mailing list