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:
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(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, Exception ex)
          Notifies all registered listeners of the exception and calls the first handler that was returned by the listeners.
 void onExceptionRequestHandlerResolved(IRequestHandler handler, Exception exception)
          Called when an IRequestHandler is resolved for an exception and will be executed.
 void onRequestHandlerResolved(IRequestHandler handler)
          Called when an IRequestHandler is resolved and will be executed.
 void onRequestHandlerScheduled(IRequestHandler handler)
          Called when a IRequestHandler has been scheduled.
 
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,
                                   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(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(IRequestHandler handler,
                                              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(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)


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