@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 |
---|---|
org.springframework.http.ResponseEntity<Map<String,Object>> |
error(javax.servlet.http.HttpServletRequest request) |
org.springframework.web.servlet.ModelAndView |
errorHtml(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
String |
getErrorPath()
Returns the path of the error page.
|
protected ErrorProperties |
getErrorProperties()
Provide access to the error properties.
|
protected boolean |
isIncludeStackTrace(javax.servlet.http.HttpServletRequest request,
org.springframework.http.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 org.springframework.web.servlet.ModelAndView errorHtml(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
@RequestMapping @ResponseBody public org.springframework.http.ResponseEntity<Map<String,Object>> error(javax.servlet.http.HttpServletRequest request)
protected boolean isIncludeStackTrace(javax.servlet.http.HttpServletRequest request, org.springframework.http.MediaType produces)
request
- the source requestproduces
- the media type produced (or MediaType.ALL
)protected ErrorProperties getErrorProperties()
Copyright © 2018 Pivotal Software, Inc.. All rights reserved.