@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
container 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) |
String |
getErrorPath()
Returns the path of the error page.
|
protected ErrorProperties |
getErrorProperties()
Provide access to the error properties.
|
protected boolean |
isIncludeStackTrace(HttpServletRequest request,
MediaType produces)
Determine if the stacktrace attribute should be included.
|
getErrorAttributes, getStatus, getTraceParameter, resolveErrorView
public 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 resolverspublic String getErrorPath()
ErrorController
@RequestMapping(produces="text/html") public ModelAndView errorHtml(HttpServletRequest request, HttpServletResponse response)
@RequestMapping @ResponseBody public ResponseEntity<Map<String,Object>> error(HttpServletRequest request)
protected boolean isIncludeStackTrace(HttpServletRequest request, MediaType produces)
request
- the source requestproduces
- the media type produced (or MediaType.ALL
)protected ErrorProperties getErrorProperties()
Copyright © 2019 Pivotal Software, Inc.. All rights reserved.