org.apache.wicket.request
Class RequestHandlerStack

java.lang.Object
  extended by org.apache.wicket.request.RequestHandlerStack
Direct Known Subclasses:
RequestCycle

public abstract class RequestHandlerStack
extends Object

Manages stack of IRequestHandlers.

Author:
Matej Knopp, igor.vaynberg

Nested Class Summary
static class RequestHandlerStack.ReplaceHandlerException
          Exception to stop current request handler and execute a new one.
 
Constructor Summary
RequestHandlerStack(Response response)
          Construct.
 
Method Summary
 void detach()
          Detaches all IRequestHandlers.
 void executeRequestHandler(IRequestHandler handler)
          Executes the specified IRequestHandler.
 IRequestHandler getActiveRequestHandler()
          Returns currently active IRequestHandler.
protected abstract  IRequestCycle getRequestCycle()
           
 IRequestHandler getRequestHandlerScheduledAfterCurrent()
          Returns the request handler scheduled after current request handler.
 Response getResponse()
          Returns the active Response.
 void replaceAllRequestHandlers(IRequestHandler handler)
          Removes the whole IRequestHandler stack, terminates currently running IRequestHandler and executes the new IRequestHandler.
 void replaceCurrentRequestHandler(IRequestHandler handler)
          Replaces the currently executed IRequestHandler with new IRequestHandler.
 void scheduleRequestHandlerAfterCurrent(IRequestHandler handler)
          Schedules the request handler to be executed after current request handler finishes.
 Response setResponse(Response response)
          Replaces current Response with new Response instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RequestHandlerStack

public RequestHandlerStack(Response response)
Construct.

Parameters:
response -
Method Detail

getRequestCycle

protected abstract IRequestCycle getRequestCycle()

getActiveRequestHandler

public IRequestHandler getActiveRequestHandler()
Returns currently active IRequestHandler.

Returns:
Active RequestHandler or null if no handler is active.

executeRequestHandler

public void executeRequestHandler(IRequestHandler handler)
Executes the specified IRequestHandler. When the specified IRequestHandler finishes, the IRequestHandler that invoked this method continues (unless the new IRequestHandler called replaceAllRequestHandlers(IRequestHandler).

Parameters:
handler -

scheduleRequestHandlerAfterCurrent

public void scheduleRequestHandlerAfterCurrent(IRequestHandler handler)
Schedules the request handler to be executed after current request handler finishes. If there is already another request handler scheduled it will be discarded and overwritten by the new one. If replaceCurrentRequestHandler(IRequestHandler) or replaceAllRequestHandlers(IRequestHandler) is invoked during current request handler execution the scheduled handler will be also discarded.

Parameters:
handler - handler to be executed after current request handler finishes

getRequestHandlerScheduledAfterCurrent

public IRequestHandler getRequestHandlerScheduledAfterCurrent()
Returns the request handler scheduled after current request handler.

Returns:
handler or null
See Also:
scheduleRequestHandlerAfterCurrent(IRequestHandler)

replaceCurrentRequestHandler

public void replaceCurrentRequestHandler(IRequestHandler handler)
Replaces the currently executed IRequestHandler with new IRequestHandler. The currently executed IRequestHandler is terminated and the new IRequestHandler is executed.

Parameters:
handler -

replaceAllRequestHandlers

public void replaceAllRequestHandlers(IRequestHandler handler)
Removes the whole IRequestHandler stack, terminates currently running IRequestHandler and executes the new IRequestHandler.

Parameters:
handler -

getResponse

public Response getResponse()
Returns the active Response.

Returns:
response object.

setResponse

public Response setResponse(Response response)
Replaces current Response with new Response instance. The original response is always restored after the IRequestHandler.respond(IRequestCycle) method is finished.

Parameters:
response -
Returns:
Response being replaced.

detach

public void detach()
Detaches all IRequestHandlers.



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