java.lang.Object | ||
↳ | org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver | |
↳ | org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver |
Default implementation of the HandlerExceptionResolver
interface that resolves standard Spring exceptions and translates
them to corresponding HTTP status codes.
This exception resolver is enabled by default in the DispatcherServlet
.
handleNoSuchRequestHandlingMethod(NoSuchRequestHandlingMethodException, HttpServletRequest, HttpServletResponse, Object)
handleHttpRequestMethodNotSupported(HttpRequestMethodNotSupportedException, HttpServletRequest, HttpServletResponse, Object)
handleHttpMediaTypeNotSupported(HttpMediaTypeNotSupportedException, HttpServletRequest, HttpServletResponse, Object)
handleMissingServletRequestParameter(MissingServletRequestParameterException, HttpServletRequest, HttpServletResponse, Object)
handleTypeMismatch(TypeMismatchException, HttpServletRequest, HttpServletResponse, Object)
handleHttpMessageNotReadable(HttpMessageNotReadableException, HttpServletRequest, HttpServletResponse, Object)
handleHttpMessageNotWritable(HttpMessageNotWritableException, HttpServletRequest, HttpServletResponse, Object)
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | PAGE_NOT_FOUND_LOG_CATEGORY | Log category to use when no mapped handler is found for a request. |
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
org.springframework.core.Ordered
|
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
pageNotFoundLogger | Additional logger to use when no mapped handler is found for a request. |
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Sets the
order to LOWEST_PRECEDENCE . |
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Actually resolve the given exception that got thrown during on handler execution,
returning a ModelAndView that represents a specific error page if appropriate.
| |||||||||||
Handle the case when a
WebDataBinder conversion cannot occur. | |||||||||||
Handle the case where no
message converters
were found that were acceptable for the client (expressed via the Accept header. | |||||||||||
Handle the case where no
message converters
were found for the PUT or POSTed content. | |||||||||||
Handle the case where a
message converter
cannot read from a HTTP request. | |||||||||||
Handle the case where a
message converter
cannot write to a HTTP request. | |||||||||||
Handle the case where no request handler method was found for the particular HTTP request method.
| |||||||||||
Handle the case when a required parameter is missing.
| |||||||||||
Handle the case where no request handler method was found.
| |||||||||||
Handle the case when a
WebDataBinder conversion error occurs. |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
org.springframework.core.Ordered
| |||||||||||
From interface
org.springframework.web.servlet.HandlerExceptionResolver
|
Log category to use when no mapped handler is found for a request.
Additional logger to use when no mapped handler is found for a request.
Actually resolve the given exception that got thrown during on handler execution, returning a ModelAndView that represents a specific error page if appropriate.
May be overridden in subclasses, in order to apply specific exception checks. Note that this template method will be invoked after checking whether this resolved applies ("mappedHandlers" etc), so an implementation may simply proceed with its actual exception handling.
request | current HTTP request |
---|---|
response | current HTTP response |
handler | the executed handler, or null if none chosen at the time
of the exception (for example, if multipart resolution failed) |
ex | the exception that got thrown during handler execution |
null
for default processing
Handle the case when a WebDataBinder
conversion cannot occur.
The default implementation sends an HTTP 500 error, and returns an empty ModelAndView
.
Alternatively, a fallback view could be chosen, or the TypeMismatchException could be rethrown as-is.
ex | the ConversionNotSupportedException to be handled |
---|---|
request | current HTTP request |
response | current HTTP response |
handler | the executed handler, or null if none chosen
at the time of the exception (for example, if multipart resolution failed) |
null
if handled directlyException | an Exception that should be thrown as result of the servlet request |
---|
Handle the case where no message converters
were found that were acceptable for the client (expressed via the Accept
header.
The default implementation sends an HTTP 406 error and returns an empty ModelAndView
.
Alternatively, a fallback view could be chosen, or the HttpMediaTypeNotAcceptableException
could be rethrown as-is.
ex | the HttpMediaTypeNotAcceptableException to be handled |
---|---|
request | current HTTP request |
response | current HTTP response |
handler | the executed handler, or null if none chosen
at the time of the exception (for example, if multipart resolution failed) |
null
if handled directlyException | an Exception that should be thrown as result of the servlet request |
---|
Handle the case where no message converters
were found for the PUT or POSTed content.
The default implementation sends an HTTP 415 error,
sets the "Accept" header, and returns an empty ModelAndView
. Alternatively, a fallback
view could be chosen, or the HttpMediaTypeNotSupportedException could be rethrown as-is.
ex | the HttpMediaTypeNotSupportedException to be handled |
---|---|
request | current HTTP request |
response | current HTTP response |
handler | the executed handler, or null if none chosen
at the time of the exception (for example, if multipart resolution failed) |
null
if handled directlyException | an Exception that should be thrown as result of the servlet request |
---|
Handle the case where a message converter
cannot read from a HTTP request.
The default implementation sends an HTTP 400 error, and returns an empty ModelAndView
.
Alternatively, a fallback view could be chosen, or the HttpMediaTypeNotSupportedException could be
rethrown as-is.
ex | the HttpMessageNotReadableException to be handled |
---|---|
request | current HTTP request |
response | current HTTP response |
handler | the executed handler, or null if none chosen
at the time of the exception (for example, if multipart resolution failed) |
null
if handled directlyException | an Exception that should be thrown as result of the servlet request |
---|
Handle the case where a message converter
cannot write to a HTTP request.
The default implementation sends an HTTP 500 error, and returns an empty ModelAndView
.
Alternatively, a fallback view could be chosen, or the HttpMediaTypeNotSupportedException could be
rethrown as-is.
ex | the HttpMessageNotWritableException to be handled |
---|---|
request | current HTTP request |
response | current HTTP response |
handler | the executed handler, or null if none chosen
at the time of the exception (for example, if multipart resolution failed) |
null
if handled directlyException | an Exception that should be thrown as result of the servlet request |
---|
Handle the case where no request handler method was found for the particular HTTP request method.
The default implementation logs a warning, sends an HTTP 405 error, sets the "Allow" header,
and returns an empty ModelAndView
. Alternatively, a fallback view could be chosen,
or the HttpRequestMethodNotSupportedException could be rethrown as-is.
ex | the HttpRequestMethodNotSupportedException to be handled |
---|---|
request | current HTTP request |
response | current HTTP response |
handler | the executed handler, or null if none chosen
at the time of the exception (for example, if multipart resolution failed) |
null
if handled directlyException | an Exception that should be thrown as result of the servlet request |
---|
Handle the case when a required parameter is missing.
The default implementation sends an HTTP 400 error, and returns an empty ModelAndView
.
Alternatively, a fallback view could be chosen, or the MissingServletRequestParameterException
could be rethrown as-is.
ex | the MissingServletRequestParameterException to be handled |
---|---|
request | current HTTP request |
response | current HTTP response |
handler | the executed handler, or null if none chosen
at the time of the exception (for example, if multipart resolution failed) |
null
if handled directlyException | an Exception that should be thrown as result of the servlet request |
---|
Handle the case where no request handler method was found.
The default implementation logs a warning, sends an HTTP 404 error, and returns
an empty ModelAndView
. Alternatively, a fallback view could be chosen,
or the NoSuchRequestHandlingMethodException could be rethrown as-is.
ex | the NoSuchRequestHandlingMethodException to be handled |
---|---|
request | current HTTP request |
response | current HTTP response |
handler | the executed handler, or null if none chosen
at the time of the exception (for example, if multipart resolution failed) |
null
if handled directlyException | an Exception that should be thrown as result of the servlet request |
---|
Handle the case when a WebDataBinder
conversion error occurs.
The default implementation sends an HTTP 400 error, and returns an empty ModelAndView
.
Alternatively, a fallback view could be chosen, or the TypeMismatchException could be rethrown as-is.
ex | the TypeMismatchException to be handled |
---|---|
request | current HTTP request |
response | current HTTP response |
handler | the executed handler, or null if none chosen
at the time of the exception (for example, if multipart resolution failed) |
null
if handled directlyException | an Exception that should be thrown as result of the servlet request |
---|