javajsfphaselistener

How to get invoked method's name from PhaseEvent in JSF


I have this PhaseListner:

public class CheckAccessInterceptor implements PhaseListener {
    private static final long serialVersionUID = -311454347719850720L;
    private static Logger logger = Logger.getLogger(CheckAccessInterceptor.class);

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

    public void beforePhase(PhaseEvent event) {
        System.out.println("START PHASE " + event.getPhaseId());
    }

    public void afterPhase(PhaseEvent event) {
        System.out.println("END PHASE " + event.getPhaseId());
    }

}

Is it possible to get ManagedBean's name and invoked method's name from PhaseEvent object? How?

UPDATED:

I find solution here but looks like it doesnt work with Ajax. So I dont know what to do.


Solution

  • So right answer is here

    But I must warn you, it work with actions only, not actionlisters.

    maple_shaft's solution works too, but in my opinion BalusC's solution better.