This content has been marked as final.
Show 1 reply
-
1. Re: How to store variables within seam sessions. How to use regular servlets with seam.
damianharvey.damianharvey.gmail.com Aug 13, 2008 7:29 PM (in response to jj2themax)I haven't looked at anything to do with FaceBook Apps but:
1) You can use any of these contexts depending on how long you want the sessionKey to stick around for. Given it's name, I'd think the session context sounds most likely. Either outject it into the Session context eg;
@Out(scope=ScopeType.SESSION) private String sessionKey;
or set it yourself inline in a method:
Contexts.getSessionContext().set("sessionKey", sessionKey);
2) You could do the whole thing with servlets, but it sounds painful. In a servlet you can access Seam components like this:
Component.getInstance("mySeamBean");
but you may find it more useful just to have Seam Beans (SLSB, SFSB, POJO, whatever) and get the ServletResponse eg:
public void someAction() { try { final HttpServletResponse resp = (HttpServletResponse) facesContext.getExternalContext().getResponse(); resp.getOutputStream().write(...whatever you want...); resp.getOutputStream().flush(); resp.getOutputStream().close(); facesContext.responseComplete(); } catch (IOException e) { e.printStacktrace(); } }
Cheers,
Damian.