public abstract class AbstractHandlerMethodExceptionResolver extends AbstractHandlerExceptionResolver
HandlerExceptionResolver
implementations that support handling exceptions from handlers of type HandlerMethod
.logger
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
Constructor and Description |
---|
AbstractHandlerMethodExceptionResolver() |
Modifier and Type | Method and Description |
---|---|
protected ModelAndView |
doResolveException(HttpServletRequest request,
HttpServletResponse response,
java.lang.Object handler,
java.lang.Exception ex)
Actually resolve the given exception that got thrown during handler execution,
returning a
ModelAndView that represents a specific error page if appropriate. |
protected abstract ModelAndView |
doResolveHandlerMethodException(HttpServletRequest request,
HttpServletResponse response,
HandlerMethod handlerMethod,
java.lang.Exception ex)
Actually resolve the given exception that got thrown during on handler execution,
returning a ModelAndView that represents a specific error page if appropriate.
|
protected boolean |
shouldApplyTo(HttpServletRequest request,
java.lang.Object handler)
Checks if the handler is a
HandlerMethod and then delegates to the
base class implementation of #shouldApplyTo(HttpServletRequest, Object)
passing the bean of the HandlerMethod . |
buildLogMessage, getOrder, logException, prepareResponse, preventCaching, resolveException, setMappedHandlerClasses, setMappedHandlers, setOrder, setPreventResponseCaching, setWarnLogCategory
public AbstractHandlerMethodExceptionResolver()
protected boolean shouldApplyTo(HttpServletRequest request, @Nullable java.lang.Object handler)
HandlerMethod
and then delegates to the
base class implementation of #shouldApplyTo(HttpServletRequest, Object)
passing the bean of the HandlerMethod
. Otherwise returns false
.shouldApplyTo
in class AbstractHandlerExceptionResolver
request
- current HTTP requesthandler
- the executed handler, or null
if none chosen
at the time of the exception (for example, if multipart resolution failed)AbstractHandlerExceptionResolver.setMappedHandlers(java.util.Set<?>)
,
AbstractHandlerExceptionResolver.setMappedHandlerClasses(java.lang.Class<?>...)
@Nullable protected final ModelAndView doResolveException(HttpServletRequest request, HttpServletResponse response, @Nullable java.lang.Object handler, java.lang.Exception ex)
AbstractHandlerExceptionResolver
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.
doResolveException
in class AbstractHandlerExceptionResolver
request
- current HTTP requestresponse
- current HTTP responsehandler
- 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 executionModelAndView
to forward to,
or null
for default processing in the resolution chain@Nullable protected abstract ModelAndView doResolveHandlerMethodException(HttpServletRequest request, HttpServletResponse response, @Nullable HandlerMethod handlerMethod, java.lang.Exception ex)
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 requestresponse
- current HTTP responsehandlerMethod
- the executed handler method, 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 executionnull
for default processing