Interface ErrorResponseHandler
-
- All Known Implementing Classes:
HttpServletBase
public interface ErrorResponseHandler
Callback interface optionally implemented byHttpServlet
sub-classes.The
onError(HttpServletRequest, HttpServletResponse, int, Throwable)
method will be invoked whenever the runtime raises an error condition, for example if a401 - 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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
onError(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, int statusCode, java.lang.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).
-
-
-
Method Detail
-
onError
boolean onError(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, int statusCode, java.lang.Throwable cause) throws javax.servlet.ServletException, java.io.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
- TheHttpServletRequest
for the current requestresponse
- TheHttpServletResponse
for 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 handledjava.io.IOException
- if an I/O error occurs while reading the request or writing the response
-
-