tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tony L. Mai" <>
Subject Help please. Does Tomcat 5.5 support PhaseListener?
Date Tue, 13 Feb 2007 20:36:13 GMT
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

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)
???????	(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)

		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.

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message