Interface ErrorResponseHandler
- All Known Implementing Classes:
HttpServletBase
public interface ErrorResponseHandler
Callback interface optionally implemented by
HttpServlet sub-classes.
The onError(HttpServletRequest, HttpServletResponse, int, Throwable)
method will be invoked whenever the runtime raises an error condition, for
example if a 401 - Unauthorized condition is raised by the
authorization infrastructure.
This provides a servlet the means to override the standard error handling and rendering logic of the runtime, and provide it's own custom behaviour.
- Author:
- cdivilly
-
Method Summary
-
Method Details
-
onError
boolean onError(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, int statusCode, Throwable cause) throws javax.servlet.ServletException, IOException Called when the runtime is about to raise an error condition (i.e report an HTTP status code in the 400-499 range).- Parameters:
request- TheHttpServletRequestfor the current requestresponse- TheHttpServletResponsefor the current responsestatusCode- The HTTP status code to be raisedcause- The cause of the error condition, may be null- Returns:
- If this handler generates a response for the error condition this
method must return
true. If this method does not handle the error condition this method must returnfalse. In which case the standard runtime's error handling will be invoked - Throws:
javax.servlet.ServletException- if the request cannot be handledIOException- if an I/O error occurs while reading the request or writing the response
-