Thursday, April 29, 2010

JSF Phase Listener for ADF

Make sure you hook into the After Phase method on RESTORE_VIEW otherwise the adf context will not have been initialized.





public void afterPhase(PhaseEvent phaseEvent) {
   System.out.println("___________________________________ -after phase is logged in " + isLoggedIn());
}

private boolean isLoggedIn() {
    if (ADFContext.getCurrent() == null ||     ADFContext.getCurrent().getSecurityContext() == null ||
    ADFContext.getCurrent().getSecurityContext().getUserName() == null ||     ANONYMOUS_USERNAME.equalsIgnoreCase(ADFContext.getCurrent().getSecurityContext().getUserName()))
    {
        return false;
    }
    ADFContext.getCurrent().getSecurityContext().getUserName());
    return true;
}

No comments:

Post a Comment