org.apache.wicket.request.cycle
Class RequestCycleListenerCollection

java.lang.Object
  extended by org.apache.wicket.util.listener.ListenerCollection<IRequestCycleListener>
      extended by org.apache.wicket.request.cycle.RequestCycleListenerCollection
All Implemented Interfaces:
java.io.Serializable, java.lang.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(IRequestHandler) and #onRequestHandlerResolved(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:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.wicket.util.listener.ListenerCollection
ListenerCollection.INotifier<T>
 
Constructor Summary
RequestCycleListenerCollection()
           
 
Method Summary
 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 the onDetach event in first in last out order (i.e.
 void onEndRequest(RequestCycle cycle)
          Notifies all registered listeners of the onEndRequest event in first in last out order (i.e.
 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.
 void onExceptionRequestHandlerResolved(RequestCycle cycle, IRequestHandler handler, java.lang.Exception exception)
          Called when an IRequestHandler is resolved for an exception and will be executed.
 void onRequestHandlerExecuted(RequestCycle cycle, IRequestHandler handler)
          Called after an IRequestHandler has been executed.
 void onRequestHandlerResolved(RequestCycle cycle, IRequestHandler handler)
          Called when an IRequestHandler is resolved and will be executed.
 void onRequestHandlerScheduled(RequestCycle cycle, IRequestHandler handler)
          Called when a IRequestHandler has been scheduled.
 void onUrlMapped(RequestCycle cycle, IRequestHandler handler, Url url)
          Called after a Url is generated for a IRequestHandler.
 
Methods inherited from class org.apache.wicket.util.listener.ListenerCollection
add, isAllowingDuplicates, isAllowingNulls, iterator, notify, notifyIgnoringExceptions, remove, reversedNotify
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 of onBeginRequest.

Specified by:
onBeginRequest in interface IRequestCycleListener

onEndRequest

public void onEndRequest(RequestCycle cycle)
Notifies all registered listeners of the onEndRequest event in first in last out order (i.e. the last listener that received an #onBeginRequest will be the first to get notified of an onEndRequest.

Specified by:
onEndRequest in interface IRequestCycleListener
See Also:
IRequestCycleListener.onEndRequest(RequestCycle)

onDetach

public void onDetach(RequestCycle cycle)
Notifies all registered listeners of the onDetach event in first in last out order (i.e. the last listener that received an #onBeginRequest will be the first to get notified of an onDetach.

Specified by:
onDetach in interface IRequestCycleListener
See Also:
IRequestCycleListener.onDetach(RequestCycle)

onException

public 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:
onException in interface IRequestCycleListener
ex - the exception that was passed in to RequestCycle.handleException(Exception)
Returns:
request handler that will be executed or null if none. If a request handler is returned, it will override any configured exception mapper
See Also:
IRequestCycleListener.onException(RequestCycle, Exception)

onRequestHandlerResolved

public void onRequestHandlerResolved(RequestCycle cycle,
                                     IRequestHandler handler)
Description copied from interface: IRequestCycleListener
Called when an IRequestHandler is resolved and will be executed.

Specified by:
onRequestHandlerResolved in interface IRequestCycleListener

onExceptionRequestHandlerResolved

public void onExceptionRequestHandlerResolved(RequestCycle cycle,
                                              IRequestHandler handler,
                                              java.lang.Exception exception)
Description copied from interface: IRequestCycleListener
Called when an IRequestHandler is resolved for an exception and will be executed.

Specified by:
onExceptionRequestHandlerResolved in interface IRequestCycleListener

onRequestHandlerScheduled

public void onRequestHandlerScheduled(RequestCycle cycle,
                                      IRequestHandler handler)
Description copied from interface: IRequestCycleListener
Called when a IRequestHandler has been scheduled. Can be called multiple times during a request when new handlers get scheduled for processing.

Specified by:
onRequestHandlerScheduled in interface IRequestCycleListener
See Also:
RequestCycle.scheduleRequestHandlerAfterCurrent(IRequestHandler)

onRequestHandlerExecuted

public void onRequestHandlerExecuted(RequestCycle cycle,
                                     IRequestHandler handler)
Description copied from interface: IRequestCycleListener
Called after an IRequestHandler has been executed. If the execution resulted in an exception this method will not be called for that particular IRequestHandler.

Specified by:
onRequestHandlerExecuted in interface IRequestCycleListener

onUrlMapped

public void onUrlMapped(RequestCycle cycle,
                        IRequestHandler handler,
                        Url url)
Description copied from interface: IRequestCycleListener
Called after a Url is generated for a IRequestHandler. This method can be used to modify generated urls, for example query parameters can be added.

Specified by:
onUrlMapped in interface IRequestCycleListener


Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.