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 theEvents
utility class and calls them back for each matching phase.This differs in a few subtle ways from
subscribeToViewXxxPhase()
methods of theEvents
class 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 void
add(PhaseListener phaseListener)
Adds the given phase listener to the current request scope.void
afterPhase(PhaseEvent event)
void
beforePhase(PhaseEvent event)
PhaseId
getPhaseId()
static boolean
remove(PhaseListener phaseListener)
Removes the given phase listener from the current request scope.
-
-
-
Method Detail
-
getPhaseId
public PhaseId getPhaseId()
- Specified by:
getPhaseId
in interfacePhaseListener
-
beforePhase
public void beforePhase(PhaseEvent event)
- Specified by:
beforePhase
in interfacePhaseListener
-
afterPhase
public void afterPhase(PhaseEvent event)
- Specified by:
afterPhase
in 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:
true
if the current request scope indeed contained the given phase listener.
-
-