문제

I'm working on a PhaseListener which runs before RESTORE_VIEW and I need to know whether it runs for the first time in the current session or not (so that I can do some auto-login for stay-logged-in-users).

Any hints for me?

도움이 되었습니까?

해결책

Yes, you can do such a thing. I have a same phase listener:

@Override
public PhaseId getPhaseId() {
    return PhaseId.RESTORE_VIEW;
}

@Override
public void beforePhase(PhaseEvent event) {
    FacesContext ctx = FacesContext.getCurrentInstance();
    if (!ctx.isPostback()) {
    authRet = // check for active session
    if (!authRet) {
         if (...)// check for cookies { //create auth}
         else { // redirect to login }
    }
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top