Class CallbackPhaseListener
- java.lang.Object
-
- org.omnifaces.eventlistener.CallbackPhaseListener
-
- All Implemented Interfaces:
PhaseListener,Serializable,EventListener
public class CallbackPhaseListener extends Object implements PhaseListener
This phase listener picks up phase listener instances and phase event callbacks from the request scope subscribed via
subscribeToRequestXxxPhase()methods of theEventsutility class and calls them back for each matching phase.This differs in a few subtle ways from
subscribeToViewXxxPhase()methods of theEventsclass which subscribes to the view scope. Namely, this phase listener will execute slightly earlier for its before phase and slightly later for its after phase as compared to the view scoped ones. Additionally, the phase listener instances and phase event callbacks registered via this phase listener will not become part of the view state, but will execute only once during the current request instead of during every (postback) request on the same view.- Since:
- 1.2
- Author:
- Arjan Tijms, Bauke Scholtz
- See Also:
Events, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CallbackPhaseListener()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidadd(PhaseListener phaseListener)Adds the given phase listener to the current request scope.voidafterPhase(PhaseEvent event)voidbeforePhase(PhaseEvent event)PhaseIdgetPhaseId()static booleanremove(PhaseListener phaseListener)Removes the given phase listener from the current request scope.
-
-
-
Method Detail
-
getPhaseId
public PhaseId getPhaseId()
- Specified by:
getPhaseIdin interfacePhaseListener
-
beforePhase
public void beforePhase(PhaseEvent event)
- Specified by:
beforePhasein interfacePhaseListener
-
afterPhase
public void afterPhase(PhaseEvent event)
- Specified by:
afterPhasein interfacePhaseListener
-
add
public static void add(PhaseListener phaseListener)
Adds the given phase listener to the current request scope.- Parameters:
phaseListener- The phase listener to be added to the current request scope.
-
remove
public static boolean remove(PhaseListener phaseListener)
Removes the given phase listener from the current request scope.- Parameters:
phaseListener- The phase listener to be removed from the current request scope.- Returns:
trueif the current request scope indeed contained the given phase listener.
-
-