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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to