@Order(value=-2147483648) public class DefaultErrorAttributes extends Object implements ErrorAttributes, HandlerExceptionResolver, Ordered
ErrorAttributes. Provides the following attributes
when possible:
ObjectErrors from a BindingResult exception (if
configured)ErrorAttributesHIGHEST_PRECEDENCE, LOWEST_PRECEDENCE| Constructor and Description |
|---|
DefaultErrorAttributes()
Create a new
DefaultErrorAttributes instance. |
DefaultErrorAttributes(boolean includeException)
Deprecated.
since 2.3.0 for removal in 2.5.0 in favor of
ErrorAttributeOptions.including(Include...) |
| Modifier and Type | Method and Description |
|---|---|
Throwable |
getError(WebRequest webRequest)
Return the underlying cause of the error or
null if the error cannot be
extracted. |
Map<String,Object> |
getErrorAttributes(WebRequest webRequest,
boolean includeStackTrace)
Deprecated.
|
Map<String,Object> |
getErrorAttributes(WebRequest webRequest,
ErrorAttributeOptions options)
Returns a
Map of the error attributes. |
protected String |
getMessage(WebRequest webRequest,
Throwable error)
Returns the message to be included as the value of the
message error
attribute. |
int |
getOrder() |
ModelAndView |
resolveException(HttpServletRequest request,
HttpServletResponse response,
Object handler,
Exception ex) |
public DefaultErrorAttributes()
DefaultErrorAttributes instance.@Deprecated public DefaultErrorAttributes(boolean includeException)
ErrorAttributeOptions.including(Include...)DefaultErrorAttributes instance.includeException - whether to include the "exception" attributepublic ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex)
resolveException in interface HandlerExceptionResolverpublic Map<String,Object> getErrorAttributes(WebRequest webRequest, ErrorAttributeOptions options)
ErrorAttributesMap of the error attributes. The map can be used as the model of
an error page ModelAndView, or returned as a
@ResponseBody.getErrorAttributes in interface ErrorAttributeswebRequest - the source requestoptions - options for error attribute contents@Deprecated public Map<String,Object> getErrorAttributes(WebRequest webRequest, boolean includeStackTrace)
ErrorAttributesMap of the error attributes. The map can be used as the model of
an error page ModelAndView, or returned as a
@ResponseBody.getErrorAttributes in interface ErrorAttributeswebRequest - the source requestincludeStackTrace - if stack trace element should be includedprotected String getMessage(WebRequest webRequest, Throwable error)
message error
attribute. By default the returned message is the first of the following that is
not empty:
RequestDispatcher.ERROR_MESSAGE request attribute.
error.
No message available.
webRequest - current requesterror - current error, if anypublic Throwable getError(WebRequest webRequest)
ErrorAttributesnull if the error cannot be
extracted.getError in interface ErrorAttributeswebRequest - the source requestException that caused the error or null