Module org.apache.wicket.core
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
Composite
IRequestCycleListener
that notifies all registered listeners with each
IRequestCycleListener event.
Order of notification
onBeginRequest(RequestCycle)
, onRequestHandlerScheduled(RequestCycle, IRequestHandler)
and
onRequestHandlerResolved(RequestCycle, IRequestHandler)
are notified in first in, first out order.
onEndRequest(RequestCycle)
and onDetach(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 in onException(RequestCycle, Exception)
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.wicket.util.listener.ListenerCollection
ListenerCollection.INotifier<T>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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
.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
.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
.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 Details
-
RequestCycleListenerCollection
public RequestCycleListenerCollection()
-
-
Method Details
-
onBeginRequest
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
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:
-
onDetach
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:
-
onException
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:
-
onRequestHandlerResolved
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
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:
-
onRequestHandlerExecuted
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
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
-