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:
java.io.Serializable,java.lang.Iterable<IRequestCycleListener>,IRequestCycleListener
public class RequestCycleListenerCollection extends org.apache.wicket.util.listener.ListenerCollection<IRequestCycleListener> implements IRequestCycleListener
CompositeIRequestCycleListenerthat 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
RequestCycleListenerCollectionwill use the first exception handler that is returned from all listeners inonException(RequestCycle, Exception)- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description RequestCycleListenerCollection()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidonBeginRequest(RequestCycle cycle)Notifies all registered listeners of the onBeginRequest event in first in first out order, i.e.voidonDetach(RequestCycle cycle)Notifies all registered listeners of theonDetachevent in first in last out order (i.e.voidonEndRequest(RequestCycle cycle)Notifies all registered listeners of theonEndRequestevent in first in last out order (i.e.org.apache.wicket.request.IRequestHandleronException(RequestCycle cycle, java.lang.Exception ex)Notifies all registered listeners of the exception and calls the first handler that was returned by the listeners.voidonExceptionRequestHandlerResolved(RequestCycle cycle, org.apache.wicket.request.IRequestHandler handler, java.lang.Exception exception)Called when anIRequestHandleris resolved for an exception and will be executed.voidonRequestHandlerExecuted(RequestCycle cycle, org.apache.wicket.request.IRequestHandler handler)Called after anIRequestHandlerhas been executed.voidonRequestHandlerResolved(RequestCycle cycle, org.apache.wicket.request.IRequestHandler handler)Called when anIRequestHandleris resolved and will be executed.voidonRequestHandlerScheduled(RequestCycle cycle, org.apache.wicket.request.IRequestHandler handler)Called when aIRequestHandlerhas been scheduled.voidonUrlMapped(RequestCycle cycle, org.apache.wicket.request.IRequestHandler handler, org.apache.wicket.request.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
-
-
-
-
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:
onBeginRequestin interfaceIRequestCycleListener
-
onEndRequest
public void onEndRequest(RequestCycle cycle)
Notifies all registered listeners of theonEndRequestevent in first in last out order (i.e. the last listener that received an#onBeginRequestwill be the first to get notified of anonEndRequest.- Specified by:
onEndRequestin interfaceIRequestCycleListener- See Also:
IRequestCycleListener.onEndRequest(RequestCycle)
-
onDetach
public void onDetach(RequestCycle cycle)
Notifies all registered listeners of theonDetachevent in first in last out order (i.e. the last listener that received an#onBeginRequestwill be the first to get notified of anonDetach.- Specified by:
onDetachin interfaceIRequestCycleListener- See Also:
IRequestCycleListener.onDetach(RequestCycle)
-
onException
public org.apache.wicket.request.IRequestHandler onException(RequestCycle cycle, java.lang.Exception ex)
Notifies all registered listeners of the exception and calls the first handler that was returned by the listeners.- Specified by:
onExceptionin interfaceIRequestCycleListener- Parameters:
cycle- The currentrequest cycleex- the exception that was passed in toRequestCycle.handleException(Exception)- Returns:
- request handler that will be executed or
nullif 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, org.apache.wicket.request.IRequestHandler handler)
Description copied from interface:IRequestCycleListenerCalled when anIRequestHandleris resolved and will be executed.- Specified by:
onRequestHandlerResolvedin interfaceIRequestCycleListener
-
onExceptionRequestHandlerResolved
public void onExceptionRequestHandlerResolved(RequestCycle cycle, org.apache.wicket.request.IRequestHandler handler, java.lang.Exception exception)
Description copied from interface:IRequestCycleListenerCalled when anIRequestHandleris resolved for an exception and will be executed.- Specified by:
onExceptionRequestHandlerResolvedin interfaceIRequestCycleListener
-
onRequestHandlerScheduled
public void onRequestHandlerScheduled(RequestCycle cycle, org.apache.wicket.request.IRequestHandler handler)
Description copied from interface:IRequestCycleListenerCalled when aIRequestHandlerhas been scheduled. Can be called multiple times during a request when new handlers get scheduled for processing.- Specified by:
onRequestHandlerScheduledin interfaceIRequestCycleListener- See Also:
RequestCycle.scheduleRequestHandlerAfterCurrent(IRequestHandler)
-
onRequestHandlerExecuted
public void onRequestHandlerExecuted(RequestCycle cycle, org.apache.wicket.request.IRequestHandler handler)
Description copied from interface:IRequestCycleListenerCalled after anIRequestHandlerhas been executed. If the execution resulted in an exception this method will not be called for that particularIRequestHandler.- Specified by:
onRequestHandlerExecutedin interfaceIRequestCycleListener
-
onUrlMapped
public void onUrlMapped(RequestCycle cycle, org.apache.wicket.request.IRequestHandler handler, org.apache.wicket.request.Url url)
Description copied from interface:IRequestCycleListenerCalled 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:
onUrlMappedin interfaceIRequestCycleListener
-
-