Package org.apache.wicket.request.cycle
Class RequestCycleListenerCollection
- java.lang.Object
-
- org.apache.wicket.util.listener.ListenerCollection<IRequestCycleListener>
-
- org.apache.wicket.request.cycle.RequestCycleListenerCollection
-
- All Implemented Interfaces:
Serializable
,Iterable<IRequestCycleListener>
,IRequestCycleListener
public class RequestCycleListenerCollection extends ListenerCollection<IRequestCycleListener> implements IRequestCycleListener
CompositeIRequestCycleListener
that notifies all registered listeners with each IRequestCycleListener event.Order of notification
onBeginRequest(RequestCycle)
,onRequestHandlerScheduled(RequestCycle, IRequestHandler)
andonRequestHandlerResolved(RequestCycle, IRequestHandler)
are notified in first in, first out order.onEndRequest(RequestCycle)
andonDetach(RequestCycle)
are notified in last in first out order (i.e. reversed order). So for these events the collection functions as a stack.Exception handling The
RequestCycleListenerCollection
will use the first exception handler that is returned from all listeners inonException(RequestCycle, Exception)
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.wicket.util.listener.ListenerCollection
ListenerCollection.INotifier<T>
-
-
Constructor Summary
Constructors Constructor Description RequestCycleListenerCollection()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
onBeginRequest(RequestCycle cycle)
Notifies all registered listeners of the onBeginRequest event in first in first out order, i.e.void
onDetach(RequestCycle cycle)
Notifies all registered listeners of theonDetach
event in first in last out order (i.e.void
onEndRequest(RequestCycle cycle)
Notifies all registered listeners of theonEndRequest
event in first in last out order (i.e.IRequestHandler
onException(RequestCycle cycle, Exception ex)
Notifies all registered listeners of the exception and calls the first handler that was returned by the listeners.void
onExceptionRequestHandlerResolved(RequestCycle cycle, IRequestHandler handler, Exception exception)
Called when anIRequestHandler
is resolved for an exception and will be executed.void
onRequestHandlerExecuted(RequestCycle cycle, IRequestHandler handler)
Called after anIRequestHandler
has been executed.void
onRequestHandlerResolved(RequestCycle cycle, IRequestHandler handler)
Called when anIRequestHandler
is resolved and will be executed.void
onRequestHandlerScheduled(RequestCycle cycle, IRequestHandler handler)
Called when aIRequestHandler
has been scheduled.void
onUrlMapped(RequestCycle cycle, IRequestHandler handler, Url url)
Called after a Url is generated for aIRequestHandler
.-
Methods inherited from class org.apache.wicket.util.listener.ListenerCollection
add, isAllowingDuplicates, isAllowingNulls, iterator, notify, notifyIgnoringExceptions, remove, reversedNotify, reversedNotifyIgnoringExceptions
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
RequestCycleListenerCollection
public RequestCycleListenerCollection()
-
-
Method Detail
-
onBeginRequest
public void onBeginRequest(RequestCycle cycle)
Notifies all registered listeners of the onBeginRequest event in first in first out order, i.e. the listener that is the first element of this collection is the first listener to be notified ofonBeginRequest
.- Specified by:
onBeginRequest
in interfaceIRequestCycleListener
-
onEndRequest
public void onEndRequest(RequestCycle cycle)
Notifies all registered listeners of theonEndRequest
event in first in last out order (i.e. the last listener that received an#onBeginRequest
will be the first to get notified of anonEndRequest
.- Specified by:
onEndRequest
in interfaceIRequestCycleListener
- See Also:
IRequestCycleListener.onEndRequest(RequestCycle)
-
onDetach
public void onDetach(RequestCycle cycle)
Notifies all registered listeners of theonDetach
event in first in last out order (i.e. the last listener that received an#onBeginRequest
will be the first to get notified of anonDetach
.- Specified by:
onDetach
in interfaceIRequestCycleListener
- See Also:
IRequestCycleListener.onDetach(RequestCycle)
-
onException
public IRequestHandler onException(RequestCycle cycle, Exception ex)
Notifies all registered listeners of the exception and calls the first handler that was returned by the listeners.- Specified by:
onException
in interfaceIRequestCycleListener
- Parameters:
cycle
- The currentrequest cycle
ex
- the exception that was passed in toRequestCycle.handleException(Exception)
- Returns:
- request handler that will be executed or
null
if none. If a request handler is returned, it will override any configuredexception mapper
. - See Also:
IRequestCycleListener.onException(RequestCycle, Exception)
-
onRequestHandlerResolved
public void onRequestHandlerResolved(RequestCycle cycle, IRequestHandler handler)
Description copied from interface:IRequestCycleListener
Called when anIRequestHandler
is resolved and will be executed.- Specified by:
onRequestHandlerResolved
in interfaceIRequestCycleListener
-
onExceptionRequestHandlerResolved
public void onExceptionRequestHandlerResolved(RequestCycle cycle, IRequestHandler handler, Exception exception)
Description copied from interface:IRequestCycleListener
Called when anIRequestHandler
is resolved for an exception and will be executed.- Specified by:
onExceptionRequestHandlerResolved
in interfaceIRequestCycleListener
-
onRequestHandlerScheduled
public void onRequestHandlerScheduled(RequestCycle cycle, IRequestHandler handler)
Description copied from interface:IRequestCycleListener
Called when aIRequestHandler
has been scheduled. Can be called multiple times during a request when new handlers get scheduled for processing.- Specified by:
onRequestHandlerScheduled
in interfaceIRequestCycleListener
- See Also:
RequestCycle.scheduleRequestHandlerAfterCurrent(IRequestHandler)
-
onRequestHandlerExecuted
public void onRequestHandlerExecuted(RequestCycle cycle, IRequestHandler handler)
Description copied from interface:IRequestCycleListener
Called after anIRequestHandler
has been executed. If the execution resulted in an exception this method will not be called for that particularIRequestHandler
.- Specified by:
onRequestHandlerExecuted
in interfaceIRequestCycleListener
-
onUrlMapped
public void onUrlMapped(RequestCycle cycle, IRequestHandler handler, Url url)
Description copied from interface:IRequestCycleListener
Called after a Url is generated for aIRequestHandler
. This method can be used to modify generated urls, for example query parameters can be added.- Specified by:
onUrlMapped
in interfaceIRequestCycleListener
-
-