Package org.apache.wicket.request.cycle
Class PageRequestHandlerTracker
- java.lang.Object
-
- org.apache.wicket.request.cycle.PageRequestHandlerTracker
-
- All Implemented Interfaces:
IRequestCycleListener
public class PageRequestHandlerTracker extends Object implements IRequestCycleListener
Registers and retrieves first and last executedIPageRequestHandler
in a request cycle. Can be used to find out what is the requested page and what is the actual response page.To use it an application needs to register it with:
application.getRequestCycleListeners().add(new PageRequestHandlerTracker());
The result can then be accessed at the end of each
RequestCycle
with:IPageRequestHandler first = PageRequestHandlerTracker.getFirstHandler(RequestCycle.get()); IPageRequestHandler last = PageRequestHandlerTracker.getLastHandler(RequestCycle.get());
- Since:
- 1.5.8
-
-
Field Summary
Fields Modifier and Type Field Description static MetaDataKey<IPageRequestHandler>
FIRST_HANDLER_KEY
The key for the first handlerstatic MetaDataKey<IPageRequestHandler>
LAST_HANDLER_KEY
The key for the last handler
-
Constructor Summary
Constructors Constructor Description PageRequestHandlerTracker()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static IPageRequestHandler
getFirstHandler(RequestCycle cycle)
retrieves first handler from the request cyclestatic IPageRequestHandler
getLastHandler(RequestCycle cycle)
retrieves last handler from request cyclevoid
onRequestHandlerResolved(RequestCycle cycle, IRequestHandler handler)
Called when anIRequestHandler
is resolved and will be executed.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.wicket.request.cycle.IRequestCycleListener
onBeginRequest, onDetach, onEndRequest, onException, onExceptionRequestHandlerResolved, onRequestHandlerExecuted, onRequestHandlerScheduled, onUrlMapped
-
-
-
-
Field Detail
-
FIRST_HANDLER_KEY
public static final MetaDataKey<IPageRequestHandler> FIRST_HANDLER_KEY
The key for the first handler
-
LAST_HANDLER_KEY
public static final MetaDataKey<IPageRequestHandler> LAST_HANDLER_KEY
The key for the last handler
-
-
Constructor Detail
-
PageRequestHandlerTracker
public PageRequestHandlerTracker()
-
-
Method Detail
-
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
-
getLastHandler
public static IPageRequestHandler getLastHandler(RequestCycle cycle)
retrieves last handler from request cycle- Parameters:
cycle
-- Returns:
- last handler
-
getFirstHandler
public static IPageRequestHandler getFirstHandler(RequestCycle cycle)
retrieves first handler from the request cycle- Parameters:
cycle
-- Returns:
- first handler
-
-