[EJB 3.0] - Storing user info on server
by jwcone
After authentication, I want to store some user information on the server, and have that user information available to subsequent calls (e.g. EJB3 session bean methods). I don't want to have to pass a "user information" object as a method parameter; I want to keep that info on the server and be able to look up the user information based on the authenticated user.
If this was purely a web application, I would store the information in the HTTP session, and look it up that way. However, my session beans service both web applications and Swing applications that aren't using HTTP. My first thought was to use a SFSB, but how do I store the stub on the server so that I get the same SFSB instance for a given authenticated user? I'd prefer this to be an entirely server-side scheme -- I was hoping to look up the user information in an @AroundInvoke interceptor.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4134110#4134110
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4134110
18 years, 1 month
[JBoss Portal] - How to stream a pdf at portlet?
by littleprince
i want to stream a pdf report to a page, but some how i got funny character when streaming. below is the code i wrote. i got this works at normal java application, but not in portlet.
FacesContext ctx=FacesContext.getCurrentInstance();
String fullPath = getReportPath(reportName);
HttpServletResponse response=(HttpServletResponse)ctx.getExternalContext().getResponse();
response.setContentType("application/pdf");
response.addHeader("Content-Disposition", "attachment; filename="+reportName+".pdf");
JasperPrint jasperPrint=JasperFillManager.fillReport(fullPath, parameters, new JRBeanCollectionDataSource(list));
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream());
ctx.getApplication().getStateManager().saveSerializedView(ctx);
ctx.responseComplete();
the result i got is
%PDF-1.4 %âãÃÂà4 0 obj <>stream xÃÂÃÂ¥ÃÂÃÂnÃÂ0ÃÂïz ÃÂCenZÃÂ[ÃÂ.hÃÂöÃÂøçâÃÂÃÂ]qÃÂúúÃÂ¥ÃÂÃÂÃÂÃÂ$$ñÃÂd>ÃÂð*óÃÂÃÂ}MîWÃÂ`ÃÂ|4ïÃÂ¥ÃÂluHÃÂæûmrónõ'ùèÃÂpö9øÃÂ2ÃÂiÃÂÃÂàÃÂÃÂüýõiÃÂÃÂÃÂýTû {ìÃÂçÃÂoöP?OÃÂææÃÂÃÂ"7þùÃÂ\ëðç<-ÃÂýzø ÃÂ&ÃÂ`ÿ,ç+ÃÂ%ÃÂÃÂý;ÃÂÃÂ=(UñâÃÂJý~LÃÂ.ÃÂçÃÂKÃÂ1æÃÂ
ÃÂ"kÃÂæ2cÃÂ$ÃÂÃÂõ_>%ÃÂ4ê_âù TvÃÂÃÂ
Q ä5Sòìý7ÃÂtTòì@$ÿðþÃÂc57[ðÃÂ|I=ÃÂú%A>_tàÃÂ`Q1næîÃÂ(à_DÃÂ
æùV~õ?ÃÂVþÃÂÃÂ>/HÃÂÿâú5EE ~ÃÂÃÂ¥@]1nîúy9è~ÃÂõÃÂëûRÃÂnÃÂÃÂÃÂ/äÃÂÃÂgÃÂ!ýÃÂ|ëÃÂq3 eÃÂ6`ÃÂG eÃÂ4ànsÃÂÿÃÂÃÂÿÃÂøÃÂ-%IÿÃÂókÃÂÃÂþþ6:*@]1nîä53öÃÂ_ÃÂ7fmÃÂmèÃÂÃÂÃÂÃÂÃÂèÿ@ÃÂF|!õÃÂi7àìÃÂ"äÃÂ
However, if i use
JasperExportManager.exportReportToPdfFile(jasperPrint,"c:\\test.pdf");
i got the pdf nicely, but it save into my local, which does not serve my need.
So what is the correct way to stream a pdf? i want to do it like a popup message to let me download the pdf.
Thanks in advance.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4134107#4134107
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4134107
18 years, 1 month