I am not able to keep the old conversation once a jasper report PDF file is displayed. I have a download page that shows some information and a download button. The first download works fine. The page blows up the second time I click on the download button because the In variables are not available in the conversation context.
Here is the code in the download button:
byte pdf = createPdfReport();
FacesContext faces = javax.faces.context.FacesContext.getCurrentInstance();
HttpServletResponse response = (HttpServletResponse) faces.getExternalContext()
response.setContentType( "application/pdf" );
response.setContentLength( pdf.length );
response.setHeader( "Content-disposition", "attachment; filename=\"" + createFileName() + "\"" );
out = response.getOutputStream();
out.write( pdf );
catch ( IOException ex )
log.error( "Could not output file:" + ex );
SeamPhaseListener does try to keep the conversation alive in afterPhase(). But the way it does it is writing conversationId to the response. The response in this case is the PDF file, which never comes back.
Another odd thing is that it always tries to reload the download page no matter which link I click on the second time. And it goes from restore_view phase to render_response phase without going through other phases.
Anybody had success with jasper reports in Seam application? Any suggestion is greatly appreciated.
Never mind. It has nothing to do with Seam. It's just the serialized view was not saved before PDF is streamed out.