-
1. Re: Some Seam and JasperReports related questions
drapierwim Nov 5, 2005 1:57 PM (in response to drapierwim)
2. When the report is generated I have an byte arry, since seam components will have a string as return value I will never get to see my report. So this will have to be an JSF Managedbean or are there other ways to deal with that.
Ok, I hate myself for doing that but you can ignore the second question,
to solve it i can just Outject it into some relevant context and the case is closed.
Sometimes I can write miles and miles of code, stop and think for a while and ending up in rewriting it in a few lines... stupid isn't it. -
2. Re: Some Seam and JasperReports related questions
gavin.king Nov 5, 2005 2:49 PM (in response to drapierwim)You should be able to get the ServletContext by navigating (and typecasting) from the FacesContext. But I think I'll add a feature to allow the ServletContext to be easily injected. I guess the same goes for HttpSession and HttpRequest....
-
3. Re: Some Seam and JasperReports related questions
drapierwim Nov 5, 2005 5:56 PM (in response to drapierwim)Are these the same?
ServletContext servletContext = (ServletContext) javax.faces.context.FacesContext.getCurrentInstance().getExternalContext().getContext();
and the @injected seam version@In private FacesContext facesContext; ... ServletContext servletContext = (ServletContext) facesContext.getContext().getExternalContext().getContext();
-
4. Re: Some Seam and JasperReports related questions
gavin.king Nov 5, 2005 5:58 PM (in response to drapierwim)yes, the are the same
-
5. Re: Some Seam and JasperReports related questions
drapierwim Nov 6, 2005 4:43 PM (in response to drapierwim)I've managed to generate my report as a byte[], but here comes the
problem I don't have a clue on how and where to place my byte[]
This is what I found on a jasper report presentation from
JBoss World 2005, how should I get a reference to the responce object
in my SFSB or are there other and better ways to solve this.response.setContentType("appliction/pdf");
response.setContentLength(bytes.length); -
6. Re: Some Seam and JasperReports related questions
patrick_ibg Nov 6, 2005 11:36 PM (in response to drapierwim)You can get to the HttpResponse object via the external web-context via the FacesContext.
-
7. Re: Some Seam and JasperReports related questions
manuel.gentile Dec 1, 2005 12:29 PM (in response to drapierwim)Sure! But if i write
response.setHeader("Content-disposition",
"attachment; filename=report.pdf" );
response.setContentType("appliction/pdf");
response.setContentLength(pdf.length);
ServletOutputStream ouputStream = response.getOutputStream();
ouputStream.write(pdf, 0, pdf.length);
ouputStream.flush();
ouputStream.close();
facesContext.responseComplete();
i break Seam and at the next operation i have an Exception!!!
if i don't write facesContext.responseComplete(); the Seam works but i have the bytes in the response as char....
Any solution?