Class AbstractHandlerMethodExceptionResolver
- java.lang.Object
- org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver
- org.springframework.web.servlet.handler.AbstractHandlerMethodExceptionResolver
- All Implemented Interfaces:
Ordered,HandlerExceptionResolver
- Direct Known Subclasses:
ExceptionHandlerExceptionResolver
public abstract class AbstractHandlerMethodExceptionResolver extends AbstractHandlerExceptionResolver
Abstract base class forHandlerExceptionResolverimplementations that support handling exceptions from handlers of typeHandlerMethod.- Since:
- 3.1
- Author:
- Rossen Stoyanchev
Field Summary
Fields inherited from class org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver
logger
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
Constructor Summary
Constructors Constructor Description AbstractHandlerMethodExceptionResolver()
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected ModelAndViewdoResolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex)Actually resolve the given exception that got thrown during handler execution, returning aModelAndViewthat represents a specific error page if appropriate.protected abstract ModelAndViewdoResolveHandlerMethodException(HttpServletRequest request, HttpServletResponse response, HandlerMethod handlerMethod, 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 booleanshouldApplyTo(HttpServletRequest request, Object handler)Checks if the handler is aHandlerMethodand then delegates to the base class implementation of#shouldApplyTo(HttpServletRequest, Object)passing the bean of theHandlerMethod.Methods inherited from class org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver
buildLogMessage, getOrder, logException, prepareResponse, preventCaching, resolveException, setMappedHandlerClasses, setMappedHandlers, setOrder, setPreventResponseCaching, setWarnLogCategory
Constructor Detail
AbstractHandlerMethodExceptionResolver
public AbstractHandlerMethodExceptionResolver()
Method Detail
shouldApplyTo
protected boolean shouldApplyTo(HttpServletRequest request, Object handler)
Checks if the handler is aHandlerMethodand then delegates to the base class implementation of#shouldApplyTo(HttpServletRequest, Object)passing the bean of theHandlerMethod. Otherwise returnsfalse.- Overrides:
shouldApplyToin classAbstractHandlerExceptionResolver- Parameters:
request- current HTTP requesthandler- the executed handler, ornullif none chosen at the time of the exception (for example, if multipart resolution failed)- Returns:
- whether this resolved should proceed with resolving the exception for the given request and handler
- See Also:
AbstractHandlerExceptionResolver.setMappedHandlers(java.util.Set<?>),AbstractHandlerExceptionResolver.setMappedHandlerClasses(java.lang.Class<?>...)
doResolveException
protected final ModelAndView doResolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex)
Description copied from class:AbstractHandlerExceptionResolverActually resolve the given exception that got thrown during handler execution, returning aModelAndViewthat 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.
- Specified by:
doResolveExceptionin classAbstractHandlerExceptionResolver- Parameters:
request- current HTTP requestresponse- current HTTP responsehandler- the executed handler, ornullif none chosen at the time of the exception (for example, if multipart resolution failed)ex- the exception that got thrown during handler execution- Returns:
- a corresponding
ModelAndViewto forward to, ornullfor default processing in the resolution chain
doResolveHandlerMethodException
protected abstract ModelAndView doResolveHandlerMethodException(HttpServletRequest request, HttpServletResponse response, HandlerMethod handlerMethod, 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.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.
- Parameters:
request- current HTTP requestresponse- current HTTP responsehandlerMethod- the executed handler method, ornullif none chosen at the time of the exception (for example, if multipart resolution failed)ex- the exception that got thrown during handler execution- Returns:
- a corresponding ModelAndView to forward to, or
nullfor default processing