Package org.eclipse.jetty.server.handler
Class ErrorHandler
java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.ContainerLifeCycle
org.eclipse.jetty.server.handler.AbstractHandler
org.eclipse.jetty.server.handler.ErrorHandler
- All Implemented Interfaces:
Handler,Container,Destroyable,Dumpable,Dumpable.DumpableContainer,LifeCycle
- Direct Known Subclasses:
ErrorPageErrorHandler
Deprecated.
The Eclipse Jetty and Apache Felix Http Jetty packages are no longer supported.
Handler for Error pages
An ErrorHandler is registered with
ContextHandler.setErrorHandler(ErrorHandler) or
Server.setErrorHandler(ErrorHandler).
It is called by the HttpResponse.sendError method to write an error page via handle(String, Request, HttpServletRequest, HttpServletResponse)
or via badMessageError(int, String, HttpFields) for bad requests for which a dispatch cannot be done.-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.eclipse.jetty.server.handler.AbstractHandler
AbstractHandler.ErrorDispatchHandlerNested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListenerNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Container
Container.InheritedListener, Container.ListenerNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
Dumpable.DumpableContainerNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
LifeCycle.Listener -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringDeprecated.static final StringDeprecated.static final StringDeprecated. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbadMessageError(int status, String reason, HttpFields fields) Deprecated.Bad Message Error bodyvoiddoError(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) Deprecated.booleanerrorPageForMethod(String method) Deprecated.Deprecated.Get the cacheControl.static ErrorHandlergetErrorHandler(Server server, ContextHandler context) Deprecated.booleanDeprecated.voidhandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) Deprecated.Handle a request.booleanDeprecated.booleanDeprecated.voidsetCacheControl(String cacheControl) Deprecated.Set the cacheControl.voidsetShowMessageInTitle(boolean showMessageInTitle) Deprecated.voidsetShowServlet(boolean showServlet) Deprecated.voidsetShowStacks(boolean showStacks) Deprecated.Methods inherited from class org.eclipse.jetty.server.handler.AbstractHandler
destroy, getServer, setServerMethods inherited from class org.eclipse.jetty.util.component.ContainerLifeCycle
addBean, addBean, addEventListener, addManaged, contains, dump, dump, dump, dump, dump, dumpObject, dumpStdErr, getBean, getBeans, getBeans, getContainedBeans, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, unmanage, updateBean, updateBean, updateBeansMethods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop, toStringMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.jetty.util.component.Dumpable.DumpableContainer
isDumpableMethods inherited from interface org.eclipse.jetty.util.component.LifeCycle
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
-
Field Details
-
ERROR_PAGE
Deprecated.- See Also:
-
ERROR_CONTEXT
Deprecated.- See Also:
-
ERROR_CHARSET
Deprecated.- See Also:
-
-
Constructor Details
-
ErrorHandler
public ErrorHandler()Deprecated.
-
-
Method Details
-
errorPageForMethod
Deprecated. -
handle
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException Deprecated.Description copied from interface:HandlerHandle a request.- Specified by:
handlein interfaceHandler- Specified by:
handlein classAbstractHandler- 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
public void doError(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException Deprecated.- Throws:
IOException
-
badMessageError
Deprecated.Bad Message Error bodyGenerate an error response body to be sent for a bad message. In this case there is something wrong with the request, so either a request cannot be built, or it is not safe to build a request. This method allows for a simple error page body to be returned and some response headers to be set.
- Parameters:
status- The error code that will be sentreason- The reason for the error code (may be null)fields- The header fields that will be sent with the response.- Returns:
- The content as a ByteBuffer, or null for no body.
-
getCacheControl
Deprecated.Get the cacheControl.- Returns:
- the cacheControl header to set on error responses.
-
setCacheControl
Deprecated.Set the cacheControl.- Parameters:
cacheControl- the cacheControl header to set on error responses.
-
isShowServlet
public boolean isShowServlet()Deprecated.- Returns:
- True if the error page will show the Servlet that generated the error
-
setShowServlet
public void setShowServlet(boolean showServlet) Deprecated.- Parameters:
showServlet- True if the error page will show the Servlet that generated the error
-
isShowStacks
public boolean isShowStacks()Deprecated.- Returns:
- True if stack traces are shown in the error pages
-
setShowStacks
public void setShowStacks(boolean showStacks) Deprecated.- Parameters:
showStacks- True if stack traces are shown in the error pages
-
setShowMessageInTitle
public void setShowMessageInTitle(boolean showMessageInTitle) Deprecated.- Parameters:
showMessageInTitle- if true, the error message appears in page title
-
getShowMessageInTitle
public boolean getShowMessageInTitle()Deprecated. -
getErrorHandler
Deprecated.
-