类 BasicErrorController
- java.lang.Object
- org.springframework.boot.autoconfigure.web.servlet.error.AbstractErrorController
- org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController
- 所有已实现的接口:
org.springframework.boot.web.servlet.error.ErrorController
@Controller @RequestMapping("${server.error.path:${error.path:/error}}") public class BasicErrorController extends AbstractErrorController
Basic global errorController
, renderingErrorAttributes
. More specific errors can be handled either using Spring MVC abstractions (e.g.@ExceptionHandler
) or by adding servletserver error pages
.- 另请参阅:
ErrorAttributes
,ErrorProperties
构造器概要
构造器 构造器 说明 BasicErrorController(org.springframework.boot.web.servlet.error.ErrorAttributes errorAttributes, ErrorProperties errorProperties)
Create a newBasicErrorController
instance.BasicErrorController(org.springframework.boot.web.servlet.error.ErrorAttributes errorAttributes, ErrorProperties errorProperties, List<ErrorViewResolver> errorViewResolvers)
Create a newBasicErrorController
instance.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 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()
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.从类继承的方法 org.springframework.boot.autoconfigure.web.servlet.error.AbstractErrorController
getErrorAttributes, getStatus, getTraceParameter, resolveErrorView
构造器详细资料
BasicErrorController
public BasicErrorController(org.springframework.boot.web.servlet.error.ErrorAttributes errorAttributes, ErrorProperties errorProperties)
Create a newBasicErrorController
instance.- 参数:
errorAttributes
- the error attributeserrorProperties
- configuration properties
BasicErrorController
public BasicErrorController(org.springframework.boot.web.servlet.error.ErrorAttributes errorAttributes, ErrorProperties errorProperties, List<ErrorViewResolver> errorViewResolvers)
Create a newBasicErrorController
instance.- 参数:
errorAttributes
- the error attributeserrorProperties
- configuration propertieserrorViewResolvers
- error view resolvers
方法详细资料
getErrorPath
public String getErrorPath()
errorHtml
@RequestMapping(produces="text/html") public org.springframework.web.servlet.ModelAndView errorHtml(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
error
@RequestMapping public org.springframework.http.ResponseEntity<Map<String,Object>> error(javax.servlet.http.HttpServletRequest request)
isIncludeStackTrace
protected boolean isIncludeStackTrace(javax.servlet.http.HttpServletRequest request, org.springframework.http.MediaType produces)
Determine if the stacktrace attribute should be included.- 参数:
request
- the source requestproduces
- the media type produced (orMediaType.ALL
)- 返回:
- if the stacktrace attribute should be included
getErrorProperties
protected ErrorProperties getErrorProperties()
Provide access to the error properties.- 返回:
- the error properties