Package org.eclipse.jetty.server.handler
Class AbstractHandler
- java.lang.Object
-
- org.eclipse.jetty.util.component.AbstractLifeCycle
-
- org.eclipse.jetty.util.component.ContainerLifeCycle
-
- org.eclipse.jetty.server.handler.AbstractHandler
-
- All Implemented Interfaces:
Handler,org.eclipse.jetty.util.component.Container,org.eclipse.jetty.util.component.Destroyable,org.eclipse.jetty.util.component.Dumpable,org.eclipse.jetty.util.component.LifeCycle
- Direct Known Subclasses:
AbstractHandler.ErrorDispatchHandler,AbstractHandlerContainer,DefaultHandler,ErrorHandler,SecuredRedirectHandler
@ManagedObject("Jetty Handler") public abstract class AbstractHandler extends org.eclipse.jetty.util.component.ContainerLifeCycle implements Handler
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractHandler.ErrorDispatchHandlerAn extension of AbstractHandler that handlesDispatcherType.ERRORdispatches.-
Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListener
-
-
Constructor Summary
Constructors Constructor Description AbstractHandler()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voiddestroy()protected voiddoError(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)Convenience method to generate error page.protected voiddoStart()protected voiddoStop()ServergetServer()abstract voidhandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)Handle a request.voidsetServer(Server server)-
Methods inherited from class org.eclipse.jetty.util.component.ContainerLifeCycle
addBean, addBean, addBean, addEventListener, addManaged, contains, dump, dump, dump, dump, dump, dumpBeans, dumpObject, dumpObjects, dumpStdErr, dumpThis, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, start, stop, unmanage, updateBean, updateBean, updateBeans
-
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop, toString
-
-
-
-
Method Detail
-
handle
public abstract void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
Description copied from interface:HandlerHandle a request.- Specified by:
handlein interfaceHandler- Parameters:
target- The target of the request - either a URI or a name.baseRequest- The original unwrapped request object.request- The request either as theRequestobject or a wrapper of that request. Themethod can be used access the Request object if required.HttpConnection.getCurrentConnection().getHttpChannel().getRequest()response- The response as theResponseobject or a wrapper of that request. Themethod can be used access the Response object if required.HttpConnection.getCurrentConnection().getHttpChannel().getResponse()- Throws:
IOException- if unable to handle the request or response processingServletException- if unable to handle the request or response due to underlying servlet issue
-
doError
protected void doError(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
Convenience method to generate error page.This method can be called from
handle(String, Request, HttpServletRequest, HttpServletResponse)when anDispatcherType.ERRORdispatch is detected and an error page needs to be generated by callingHttpServletResponse.sendError(int, String)with the appropriate code and reason, which are taken fromServletRequest.getAttribute(String)forRequestDispatcher.ERROR_STATUS_CODEandRequestDispatcher.ERROR_MESSAGE- Parameters:
target- The target of the request - either a URI or a name.baseRequest- The original unwrapped request object.request- The request either as theRequestobject or a wrapper of that request. Themethod can be used access the Request object if required.HttpConnection.getCurrentConnection().getHttpChannel().getRequest()response- The response as theResponseobject or a wrapper of that request. Themethod can be used access the Response object if required.HttpConnection.getCurrentConnection().getHttpChannel().getResponse()- Throws:
IOException- if unable to handle the request or response processingServletException- if unable to handle the request or response due to underlying servlet issue- See Also:
for a convenience class that calls this method.
-
doStart
protected void doStart() throws Exception- Overrides:
doStartin classorg.eclipse.jetty.util.component.ContainerLifeCycle- Throws:
Exception
-
doStop
protected void doStop() throws Exception- Overrides:
doStopin classorg.eclipse.jetty.util.component.ContainerLifeCycle- Throws:
Exception
-
-