public class ErrorHandler extends AbstractHandler
ContextHandler.setErrorHandler(ErrorHandler) or
Server.addBean(Object).
It is called by the HttpResponse.sendError method to write a error page.AbstractLifeCycle.AbstractLifeCycleListenerLifeCycle.Listener_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING| Constructor and Description |
|---|
ErrorHandler() |
| Modifier and Type | Method and Description |
|---|---|
String |
getCacheControl()
Get the cacheControl.
|
boolean |
getShowMessageInTitle() |
void |
handle(String target,
Request baseRequest,
HttpServletRequest request,
HttpServletResponse response)
Handle a request.
|
protected void |
handleErrorPage(HttpServletRequest request,
Writer writer,
int code,
String message) |
boolean |
isShowStacks() |
void |
setCacheControl(String cacheControl)
Set the cacheControl.
|
void |
setShowMessageInTitle(boolean showMessageInTitle) |
void |
setShowStacks(boolean showStacks) |
protected void |
write(Writer writer,
String string) |
protected void |
writeErrorPage(HttpServletRequest request,
Writer writer,
int code,
String message,
boolean showStacks) |
protected void |
writeErrorPageBody(HttpServletRequest request,
Writer writer,
int code,
String message,
boolean showStacks) |
protected void |
writeErrorPageHead(HttpServletRequest request,
Writer writer,
int code,
String message) |
protected void |
writeErrorPageMessage(HttpServletRequest request,
Writer writer,
int code,
String message,
String uri) |
protected void |
writeErrorPageStacks(HttpServletRequest request,
Writer writer) |
destroy, doStart, doStop, dumpThis, getServer, setServeraddBean, addBean, contains, dump, dump, dump, dump, dump, dumpObject, dumpStdErr, getBean, getBeans, getBeans, isManaged, manage, removeBean, removeBeans, unmanageaddLifeCycleListener, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stopclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stoppublic void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException
Handlertarget - The target of the request - either a URI or a name.baseRequest - The original unwrapped request object.request - The request either as the Request
object or a wrapper of that request. The AbstractHttpConnection.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 AbstractHttpConnection.getCurrentConnection()
method can be used access the Response object if required.IOExceptionprotected void handleErrorPage(HttpServletRequest request, Writer writer, int code, String message) throws IOException
IOExceptionprotected void writeErrorPage(HttpServletRequest request, Writer writer, int code, String message, boolean showStacks) throws IOException
IOExceptionprotected void writeErrorPageHead(HttpServletRequest request, Writer writer, int code, String message) throws IOException
IOExceptionprotected void writeErrorPageBody(HttpServletRequest request, Writer writer, int code, String message, boolean showStacks) throws IOException
IOExceptionprotected void writeErrorPageMessage(HttpServletRequest request, Writer writer, int code, String message, String uri) throws IOException
IOExceptionprotected void writeErrorPageStacks(HttpServletRequest request, Writer writer) throws IOException
IOExceptionpublic String getCacheControl()
public void setCacheControl(String cacheControl)
cacheControl - the cacheControl header to set on error responses.public boolean isShowStacks()
public void setShowStacks(boolean showStacks)
showStacks - True if stack traces are shown in the error pagespublic void setShowMessageInTitle(boolean showMessageInTitle)
showMessageInTitle - if true, the error message appears in page titlepublic boolean getShowMessageInTitle()
protected void write(Writer writer, String string) throws IOException
IOExceptionCopyright © 1995-2013 Mort Bay Consulting. All Rights Reserved.