@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. |
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
public BasicErrorController(ErrorAttributes errorAttributes, ErrorProperties errorProperties)
BasicErrorController
instance.errorAttributes
- the error attributeserrorProperties
- configuration propertiespublic 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 © 2016 Pivotal Software, Inc.. All rights reserved.