类 ExceptionHandlerAnnotationExceptionHandler
java.lang.Object
cn.taketoday.core.OrderedSupport
cn.taketoday.web.handler.AbstractHandlerExceptionHandler
cn.taketoday.web.handler.AbstractActionMappingMethodExceptionHandler
cn.taketoday.web.handler.method.ExceptionHandlerAnnotationExceptionHandler
- 所有已实现的接口:
cn.taketoday.beans.factory.Aware,cn.taketoday.beans.factory.InitializingBean,cn.taketoday.context.ApplicationContextAware,cn.taketoday.core.Ordered,HandlerExceptionHandler
public class ExceptionHandlerAnnotationExceptionHandler
extends AbstractActionMappingMethodExceptionHandler
implements cn.taketoday.context.ApplicationContextAware, cn.taketoday.beans.factory.InitializingBean
Handle
ExceptionHandler annotated method
this method indicates that is a exception handler
- 从以下版本开始:
- 2.3.7
- 作者:
- TODAY 2019-06-22 19:17
-
字段概要
字段修饰符和类型字段说明private cn.taketoday.context.ApplicationContextprivate final LinkedHashMap<ControllerAdviceBean,ExceptionHandlerMethodResolver> private final ConcurrentHashMap<Class<?>,ExceptionHandlerMethodResolver> private final ConcurrentHashMap<Method,ActionMappingAnnotationHandler> private AnnotationHandlerFactory从类继承的字段 cn.taketoday.web.handler.AbstractHandlerExceptionHandler
logger从类继承的字段 cn.taketoday.core.OrderedSupport
order从接口继承的字段 cn.taketoday.web.HandlerExceptionHandler
BEAN_NAME, NONE_RETURN_VALUE从接口继承的字段 cn.taketoday.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明voidcn.taketoday.context.ApplicationContextprivate ActionMappingAnnotationHandlergetHandler(Supplier<Object> handlerBean, Method method, Class<?> errorHandlerType) protected ObjecthandleInternal(RequestContext context, HandlerMethod handlerMethod, Throwable target) Actually resolve the given exception that got thrown during on handler execution, returning a view(result) that represents a specific error page if appropriate.protected booleanWhether this handler has global exception handlers, e.g. not declared in the same class as theHandlerMethodthat raised the exception and therefore can apply to any handler.private voidinitExceptionHandlerAdviceCache(cn.taketoday.context.ApplicationContext applicationContext) protected ActionMappingAnnotationHandlerlookupExceptionHandler(HandlerMethod handlerMethod, Throwable exception) Find an@ExceptionHandlermethod for the given exception.voidsetApplicationContext(cn.taketoday.context.ApplicationContext applicationContext) voidsetHandlerFactory(AnnotationHandlerFactory handlerFactory) protected booleanshouldApplyTo(RequestContext 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.从类继承的方法 cn.taketoday.web.handler.AbstractActionMappingMethodExceptionHandler
handleInternal从类继承的方法 cn.taketoday.web.handler.AbstractHandlerExceptionHandler
addMappedHandlerClass, buildLogMessage, getMappedHandlerClasses, handleException, hasHandlerMappings, logException, logResultedInException, prepareResponse, preventCaching, setMappedHandlerClasses, setMappedHandlers, setPreventResponseCaching, setWarnLogCategory从类继承的方法 cn.taketoday.core.OrderedSupport
getOrder, setOrder
-
字段详细资料
-
exceptionHandlerCache
-
exceptionHandlerAdviceCache
private final LinkedHashMap<ControllerAdviceBean,ExceptionHandlerMethodResolver> exceptionHandlerAdviceCache -
exceptionHandlerMapping
-
applicationContext
@Nullable private cn.taketoday.context.ApplicationContext applicationContext -
handlerFactory
-
-
构造器详细资料
-
ExceptionHandlerAnnotationExceptionHandler
public ExceptionHandlerAnnotationExceptionHandler()
-
-
方法详细资料
-
handleInternal
@Nullable protected Object handleInternal(RequestContext context, @Nullable HandlerMethod handlerMethod, Throwable target) Actually resolve the given exception that got thrown during on handler execution, returning a view(result) 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.
- 指定者:
handleInternal在类中AbstractActionMappingMethodExceptionHandler- 参数:
context- current HTTP requesthandlerMethod- the executed handler method, ornullif none chosen at the time of the exception (for example, if multipart resolution failed)target- the exception that got thrown during handler execution- 返回:
- a corresponding ModelAndView to forward to, or
nullfor default processing
-
lookupExceptionHandler
@Nullable protected ActionMappingAnnotationHandler lookupExceptionHandler(@Nullable HandlerMethod handlerMethod, Throwable exception) Find an@ExceptionHandlermethod for the given exception. The default implementation searches methods in the class hierarchy of the controller first and if not found, it continues searching for additional@ExceptionHandlermethods assuming some @ControllerAdvice Framework-managed beans were detected.- 参数:
exception- the raised exception- 返回:
- a method to handle the exception, or
nullif none
-
getHandler
private ActionMappingAnnotationHandler getHandler(Supplier<Object> handlerBean, Method method, Class<?> errorHandlerType) -
hasGlobalExceptionHandlers
protected boolean hasGlobalExceptionHandlers()Whether this handler has global exception handlers, e.g. not declared in the same class as theHandlerMethodthat raised the exception and therefore can apply to any handler. -
shouldApplyTo
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在类中AbstractActionMappingMethodExceptionHandler- 参数:
request- current HTTP request contexthandler- 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
- 另请参阅:
-
setApplicationContext
public void setApplicationContext(@Nullable cn.taketoday.context.ApplicationContext applicationContext) - 指定者:
setApplicationContext在接口中cn.taketoday.context.ApplicationContextAware
-
getApplicationContext
@Nullable public cn.taketoday.context.ApplicationContext getApplicationContext() -
setHandlerFactory
-
afterPropertiesSet
public void afterPropertiesSet()- 指定者:
afterPropertiesSet在接口中cn.taketoday.beans.factory.InitializingBean
-
initExceptionHandlerAdviceCache
private void initExceptionHandlerAdviceCache(cn.taketoday.context.ApplicationContext applicationContext)
-