public class DefaultErrorHandler extends Object implements ErrorHandler
DefaultErrorHandler
is used by the
SlingRequestProcessorImpl
as long as no ErrorHandler
service
is registered.Constructor and Description |
---|
DefaultErrorHandler() |
Modifier and Type | Method and Description |
---|---|
ErrorHandler |
getDelegate() |
void |
handleError(int status,
String message,
org.apache.sling.api.SlingHttpServletRequest request,
org.apache.sling.api.SlingHttpServletResponse response)
Backend implementation of the HttpServletResponse.sendError methods.
|
void |
handleError(Throwable throwable,
org.apache.sling.api.SlingHttpServletRequest request,
org.apache.sling.api.SlingHttpServletResponse response)
Backend implementation of handling uncaught throwables.
|
void |
setDelegate(ErrorHandler eh) |
public void setDelegate(ErrorHandler eh)
public ErrorHandler getDelegate()
public void handleError(int status, String message, org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response) throws IOException
This implementation resets the response before sending back a standardized response which just conveys the status, the message (either provided or a message derived from the status code), and server information.
This method logs error and does not write back and response data if the response has already been committed.
handleError
in interface ErrorHandler
status
- The HTTP status code to setmessage
- An optional message to write to the response. This message
may be null
.request
- The request object providing more information on the
request.response
- The response object used to send the status and message.IOException
- May be thrown if an error occurrs sending the
response.public void handleError(Throwable throwable, org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response) throws IOException
This implementation resets the response before sending back a standardized response which just conveys the status as 500/INTERNAL SERVER ERROR, the message from the throwable, the stacktrace, and server information.
This method logs error and does not write back and response data if the response has already been committed.
handleError
in interface ErrorHandler
throwable
- The Throwable
causing this method to be
called.request
- The request object providing more information on the
request.response
- The response object used to send the status and message.IOException
- May be thrown if an error occurrs sending the
response.Copyright © 2007–2016 The Apache Software Foundation. All rights reserved.