类 DefaultErrorAttributes
- java.lang.Object
- org.springframework.boot.web.servlet.error.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 (if configured)
- message - The exception message
- errors - Any
ObjectError
s from aBindingResult
exception - trace - The exception stack trace
- path - The URL path when the exception was raised
- 从以下版本开始:
- 2.0.0
- 另请参阅:
ErrorAttributes
构造器概要
构造器 构造器 说明 DefaultErrorAttributes()
Create a newDefaultErrorAttributes
instance that does not include the "exception" attribute.DefaultErrorAttributes(boolean includeException)
Create a newDefaultErrorAttributes
instance.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 Throwable
getError(org.springframework.web.context.request.WebRequest webRequest)
Return the underlying cause of the error ornull
if the error cannot be extracted.Map<String,Object>
getErrorAttributes(org.springframework.web.context.request.WebRequest webRequest, boolean includeStackTrace)
Returns aMap
of the error attributes.int
getOrder()
org.springframework.web.servlet.ModelAndView
resolveException(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Object handler, Exception ex)
构造器详细资料
DefaultErrorAttributes
public DefaultErrorAttributes()
Create a newDefaultErrorAttributes
instance that does not include the "exception" attribute.
DefaultErrorAttributes
public DefaultErrorAttributes(boolean includeException)
Create a newDefaultErrorAttributes
instance.- 参数:
includeException
- whether to include the "exception" attribute
方法详细资料
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.WebRequest webRequest, boolean includeStackTrace)
从接口复制的说明:ErrorAttributes
Returns aMap
of the error attributes. The map can be used as the model of an error pageModelAndView
, or returned as aResponseBody
.- 指定者:
getErrorAttributes
在接口中ErrorAttributes
- 参数:
webRequest
- the source requestincludeStackTrace
- if stack trace elements should be included- 返回:
- a map of error attributes
getError
public Throwable getError(org.springframework.web.context.request.WebRequest webRequest)
从接口复制的说明:ErrorAttributes
Return the underlying cause of the error ornull
if the error cannot be extracted.- 指定者:
getError
在接口中ErrorAttributes
- 参数:
webRequest
- the source request- 返回:
- the
Exception
that caused the error ornull