类 AbstractHandlerMethodExceptionResolver
- java.lang.Object
- org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver
- org.springframework.web.servlet.handler.AbstractHandlerMethodExceptionResolver
- 所有已实现的接口:
Ordered,HandlerExceptionResolver
public abstract class AbstractHandlerMethodExceptionResolver extends AbstractHandlerExceptionResolver
Abstract base class forHandlerExceptionResolverimplementations that support handling exceptions from handlers of typeHandlerMethod.- 从以下版本开始:
- 3.1
- 作者:
- Rossen Stoyanchev
字段概要
从类继承的字段 org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver
logger
从接口继承的字段 org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
构造器概要
构造器 构造器 说明 AbstractHandlerMethodExceptionResolver()
方法概要
所有方法 实例方法 抽象方法 具体方法 修饰符和类型 方法 说明 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.从类继承的方法 org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver
buildLogMessage, getOrder, logException, prepareResponse, preventCaching, resolveException, setMappedHandlerClasses, setMappedHandlers, setOrder, setPreventResponseCaching, setWarnLogCategory
构造器详细资料
AbstractHandlerMethodExceptionResolver
public AbstractHandlerMethodExceptionResolver()
方法详细资料
shouldApplyTo
protected boolean shouldApplyTo(HttpServletRequest request, @Nullable 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.- 覆盖:
shouldApplyTo在类中AbstractHandlerExceptionResolver- 参数:
request- current HTTP requesthandler- the executed handler, ornullif none chosen at the time of the exception (for example, if multipart resolution failed)- 返回:
- whether this resolved should proceed with resolving the exception for the given request and handler
- 另请参阅:
AbstractHandlerExceptionResolver.setMappedHandlers(java.util.Set<?>),AbstractHandlerExceptionResolver.setMappedHandlerClasses(java.lang.Class<?>...)
doResolveException
@Nullable protected final ModelAndView doResolveException(HttpServletRequest request, HttpServletResponse response, @Nullable Object handler, Exception ex)
从类复制的说明: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.
- 指定者:
doResolveException在类中AbstractHandlerExceptionResolver- 参数:
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- 返回:
- a corresponding
ModelAndViewto forward to, ornullfor default processing in the resolution chain
doResolveHandlerMethodException
@Nullable protected abstract ModelAndView doResolveHandlerMethodException(HttpServletRequest request, HttpServletResponse response, @Nullable 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.
- 参数:
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- 返回:
- a corresponding ModelAndView to forward to, or
nullfor default processing