public interface ErrorResponseHandler
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.
Modifier and Type | Method and Description |
---|---|
boolean |
onError(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, int statusCode, Throwable cause)
Called when the runtime is about to raise an error condition (i.e report an HTTP status code in the 400-499 range).
|
boolean onError(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, int statusCode, Throwable cause) throws javax.servlet.ServletException, IOException
request
- The HttpServletRequest
for the current requestresponse
- The HttpServletResponse
for the current responsestatusCode
- The HTTP status code to be raisedcause
- The cause of the error condition, may be nulltrue
. If this method does not handle the error condition this method must return false
. In which case the standard runtime's error handling will be invokedjavax.servlet.ServletException
- if the request cannot be handledIOException
- if an I/O error occurs while reading the request or writing the response