类 DefaultErrorAttributes
- java.lang.Object
- org.springframework.boot.autoconfigure.web.DefaultErrorAttributes
- 所有已实现的接口:
ErrorAttributes,org.springframework.core.Ordered,org.springframework.web.servlet.HandlerExceptionResolver
@Order(-2147483648) public class DefaultErrorAttributes extends Object implements ErrorAttributes, org.springframework.web.servlet.HandlerExceptionResolver, org.springframework.core.Ordered
Default implementation ofErrorAttributes. Provides the following attributes when possible:- timestamp - The time that the errors were extracted
- status - The status code
- error - The error reason
- exception - The class name of the root exception
- message - The exception message
- errors - Any
ObjectErrors from aBindingResultexception - trace - The exception stack trace
- path - The URL path when the exception was raised
- 从以下版本开始:
- 1.1.0
- 另请参阅:
ErrorAttributes
构造器概要
构造器 构造器 说明 DefaultErrorAttributes()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 ThrowablegetError(org.springframework.web.context.request.RequestAttributes requestAttributes)Return the underlying cause of the error ornullif the error cannot be extracted.Map<String,Object>getErrorAttributes(org.springframework.web.context.request.RequestAttributes requestAttributes, boolean includeStackTrace)Returns aMapof the error attributes.intgetOrder()org.springframework.web.servlet.ModelAndViewresolveException(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Object handler, Exception ex)
构造器详细资料
DefaultErrorAttributes
public DefaultErrorAttributes()
方法详细资料
getOrder
public int getOrder()
- 指定者:
getOrder在接口中org.springframework.core.Ordered
resolveException
public org.springframework.web.servlet.ModelAndView resolveException(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Object handler, Exception ex)
- 指定者:
resolveException在接口中org.springframework.web.servlet.HandlerExceptionResolver
getErrorAttributes
public Map<String,Object> getErrorAttributes(org.springframework.web.context.request.RequestAttributes requestAttributes, boolean includeStackTrace)
从接口复制的说明:ErrorAttributesReturns aMapof the error attributes. The map can be used as the model of an error pageModelAndView, or returned as aResponseBody.- 指定者:
getErrorAttributes在接口中ErrorAttributes- 参数:
requestAttributes- the source request attributesincludeStackTrace- if stack trace elements should be included- 返回:
- a map of error attributes
getError
public Throwable getError(org.springframework.web.context.request.RequestAttributes requestAttributes)
从接口复制的说明:ErrorAttributesReturn the underlying cause of the error ornullif the error cannot be extracted.- 指定者:
getError在接口中ErrorAttributes- 参数:
requestAttributes- the source request attributes- 返回:
- the
Exceptionthat caused the error ornull