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.
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....
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();
yes, the are the same
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.
You can get to the HttpResponse object via the external web-context via the FacesContext.
Sure! But if i write
"attachment; filename=report.pdf" );
ServletOutputStream ouputStream = response.getOutputStream();
ouputStream.write(pdf, 0, pdf.length);
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....