public class HandlerWrapper extends AbstractHandlerContainer
HandlerWrapper
acts as a Handler
but delegates the handle
method and
life cycle
events to a delegate. This is primarily used to implement the Decorator pattern._string
Constructor and Description |
---|
HandlerWrapper() |
Modifier and Type | Method and Description |
---|---|
void |
addHandler(Handler handler)
Add a handler.
|
protected void |
doStart() |
protected void |
doStop() |
protected java.lang.Object |
expandChildren(java.lang.Object list,
java.lang.Class byClass) |
Handler |
getHandler() |
void |
handle(java.lang.String target,
HttpServletRequest request,
HttpServletResponse response,
int dispatch)
Handle a request.
|
void |
removeHandler(Handler handler) |
void |
setHandler(Handler handler) |
void |
setServer(Server server) |
expandHandler, getChildHandlerByClass, getChildHandlers, getChildHandlersByClass
destroy, getServer, toString
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
public Handler getHandler()
public void setHandler(Handler handler)
handler
- Set the Handler
which should be wrapped.public void addHandler(Handler handler)
handler
- public void removeHandler(Handler handler)
protected void doStart() throws java.lang.Exception
doStart
in class AbstractHandler
java.lang.Exception
protected void doStop() throws java.lang.Exception
doStop
in class AbstractHandler
java.lang.Exception
public void handle(java.lang.String target, HttpServletRequest request, HttpServletResponse response, int dispatch) throws java.io.IOException, ServletException
Handler
target
- The target of the request - either a URI or a name.request
- The request either as the Request
object or a wrapper of that request. The HttpConnection.getCurrentConnection()
method can be used access the Request object if required.response
- The response as the Response
object or a wrapper of that request. The HttpConnection.getCurrentConnection()
method can be used access the Response object if required.dispatch
- The dispatch mode: Handler.REQUEST
, Handler.FORWARD
, Handler.INCLUDE
, Handler.ERROR
java.io.IOException
ServletException
public void setServer(Server server)
setServer
in interface Handler
setServer
in class AbstractHandler
protected java.lang.Object expandChildren(java.lang.Object list, java.lang.Class byClass)
expandChildren
in class AbstractHandlerContainer
Copyright © 2009 Mortbay Consulting Pty. Ltd. All Rights Reserved.