@Controller @RequestMapping(value="${server.error.path:${error.path:/error}}") public class BasicErrorController extends AbstractErrorController
@Controller, rendering ErrorAttributes.
More specific errors can be handled either using Spring MVC abstractions (e.g.
@ExceptionHandler) or by adding servlet
server error pages.ErrorAttributes,
ErrorProperties| Constructor and Description |
|---|
BasicErrorController(ErrorAttributes errorAttributes,
ErrorProperties errorProperties)
Create a new
BasicErrorController instance. |
BasicErrorController(ErrorAttributes errorAttributes,
ErrorProperties errorProperties,
List<ErrorViewResolver> errorViewResolvers)
Create a new
BasicErrorController instance. |
| Modifier and Type | Method and Description |
|---|---|
ResponseEntity<Map<String,Object>> |
error(HttpServletRequest request) |
ModelAndView |
errorHtml(HttpServletRequest request,
HttpServletResponse response) |
protected ErrorAttributeOptions |
getErrorAttributeOptions(HttpServletRequest request,
MediaType mediaType) |
protected ErrorProperties |
getErrorProperties()
Provide access to the error properties.
|
protected boolean |
isIncludeBindingErrors(HttpServletRequest request,
MediaType produces)
Determine if the errors attribute should be included.
|
protected boolean |
isIncludeMessage(HttpServletRequest request,
MediaType produces)
Determine if the message attribute should be included.
|
protected boolean |
isIncludeStackTrace(HttpServletRequest request,
MediaType produces)
Determine if the stacktrace attribute should be included.
|
ResponseEntity<String> |
mediaTypeNotAcceptable(HttpServletRequest request) |
getBooleanParameter, getErrorAttributes, getErrorsParameter, getMessageParameter, getStatus, getTraceParameter, resolveErrorViewpublic BasicErrorController(ErrorAttributes errorAttributes, ErrorProperties errorProperties)
BasicErrorController instance.errorAttributes - the error attributeserrorProperties - configuration propertiespublic BasicErrorController(ErrorAttributes errorAttributes, ErrorProperties errorProperties, List<ErrorViewResolver> errorViewResolvers)
BasicErrorController instance.errorAttributes - the error attributeserrorProperties - configuration propertieserrorViewResolvers - error view resolvers@RequestMapping(produces="text/html") public ModelAndView errorHtml(HttpServletRequest request, HttpServletResponse response)
@RequestMapping public ResponseEntity<Map<String,Object>> error(HttpServletRequest request)
@ExceptionHandler(value=org.springframework.web.HttpMediaTypeNotAcceptableException.class) public ResponseEntity<String> mediaTypeNotAcceptable(HttpServletRequest request)
protected ErrorAttributeOptions getErrorAttributeOptions(HttpServletRequest request, MediaType mediaType)
protected boolean isIncludeStackTrace(HttpServletRequest request, MediaType produces)
request - the source requestproduces - the media type produced (or MediaType.ALL)protected boolean isIncludeMessage(HttpServletRequest request, MediaType produces)
request - the source requestproduces - the media type produced (or MediaType.ALL)protected boolean isIncludeBindingErrors(HttpServletRequest request, MediaType produces)
request - the source requestproduces - the media type produced (or MediaType.ALL)protected ErrorProperties getErrorProperties()