You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Tony L. Mai" <tm...@dgateway.com> on 2007/02/13 21:36:13 UTC
Help please. Does Tomcat 5.5 support PhaseListener?
Hello all,
I have implemented a ForcedLoginPhaseListener that would intercept every JSF
Request Processing Cycle and check if user has a valid session in the
HttpServletRequest.
Basically the code is as followed:
public class ForcedLoginPhaseListener implements PhaseListener {
public void afterPhase(PhaseEvent event) {
FacesContext ctx = event.getFacesContext();
Object request = ctx.getExternalContext().getRequest();
HttpSession session = ((HttpServletRequest)
request).getSession(false);
??????? (somehow this session is always be null.)
....
}
...
}
I created a HttpSession during login procedure as followed:
Public class LoginController {
public void login(...) {
FacesContext ctx = FacesContext.getCurrentInstance();
HttpServletRequest request = (HttpServletRequest)
ctx.getExternalContext().getRequest();
HttpSession session = request.getSession(true);
(session is created here)
session.setAttribute("UserSession", usrSession);
...
}
...
}
Issue: The session obtain during the phase cycle is always null.
Question: Within the ForcedLoginPhaseListener, I need to get back the
session created during the login procedure. What do I need to do?
Thanks in advance for your help.
-tony
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org