Class 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 the Events utility class and calls them back for each matching phase.

    This differs in a few subtle ways from subscribeToViewXxxPhase() methods of the Events 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 Detail

      • CallbackPhaseListener

        public CallbackPhaseListener()
    • Method Detail

      • 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.