@Order(value=-2147483648) public class DefaultErrorAttributes extends java.lang.Object implements ErrorAttributes, org.springframework.web.servlet.HandlerExceptionResolver, org.springframework.core.Ordered
ErrorAttributes
. Provides the following attributes
when possible:
ObjectError
s from a BindingResult
exception (if
configured)ErrorAttributes
ERROR_ATTRIBUTE
Constructor and Description |
---|
DefaultErrorAttributes() |
Modifier and Type | Method and Description |
---|---|
java.lang.Throwable |
getError(org.springframework.web.context.request.WebRequest webRequest)
Return the underlying cause of the error or
null if the error cannot be
extracted. |
java.util.Map<java.lang.String,java.lang.Object> |
getErrorAttributes(org.springframework.web.context.request.WebRequest webRequest,
ErrorAttributeOptions options)
Returns a
Map of the error attributes. |
protected java.lang.String |
getMessage(org.springframework.web.context.request.WebRequest webRequest,
java.lang.Throwable error)
Returns the message to be included as the value of the
message error
attribute. |
int |
getOrder() |
org.springframework.web.servlet.ModelAndView |
resolveException(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.Object handler,
java.lang.Exception ex) |
public int getOrder()
getOrder
in interface org.springframework.core.Ordered
public org.springframework.web.servlet.ModelAndView resolveException(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.Object handler, java.lang.Exception ex)
resolveException
in interface org.springframework.web.servlet.HandlerExceptionResolver
public java.util.Map<java.lang.String,java.lang.Object> getErrorAttributes(org.springframework.web.context.request.WebRequest webRequest, ErrorAttributeOptions options)
ErrorAttributes
Map
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 ErrorAttributes
webRequest
- the source requestoptions
- options for error attribute contentsprotected java.lang.String getMessage(org.springframework.web.context.request.WebRequest webRequest, java.lang.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 java.lang.Throwable getError(org.springframework.web.context.request.WebRequest webRequest)
ErrorAttributes
null
if the error cannot be
extracted.getError
in interface ErrorAttributes
webRequest
- the source requestException
that caused the error or null