类 ErrorPageFilter
- java.lang.Object
- org.springframework.boot.web.servlet.support.ErrorPageFilter
- 所有已实现的接口:
javax.servlet.Filter
,ErrorPageRegistry
@Order(-2147483647) public class ErrorPageFilter extends Object implements javax.servlet.Filter, ErrorPageRegistry
A ServletFilter
that provides anErrorPageRegistry
for non-embedded applications (i.e. deployed WAR files). It registers error pages and handles application errors by filtering requests and forwarding to the error pages instead of letting the server handle them. Error pages are a feature of the servlet spec but there is no Java API for registering them in the spec. This filter works around that by accepting error page registrations from Spring Boot'sErrorPageRegistrar
(any beans of that type in the context will be applied to this server).- 从以下版本开始:
- 2.0.0
字段概要
字段 修饰符和类型 字段 说明 static String
ERROR_REQUEST_URI
The name of the servlet attribute containing request URI.
构造器概要
构造器 构造器 说明 ErrorPageFilter()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
addErrorPages(ErrorPage... errorPages)
Adds error pages that will be used when handling exceptions.void
destroy()
void
doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain)
protected String
getDescription(javax.servlet.http.HttpServletRequest request)
Return the description for the given request.void
init(javax.servlet.FilterConfig filterConfig)
字段详细资料
ERROR_REQUEST_URI
public static final String ERROR_REQUEST_URI
The name of the servlet attribute containing request URI.- 另请参阅:
- 常量字段值
构造器详细资料
ErrorPageFilter
public ErrorPageFilter()
方法详细资料
init
public void init(javax.servlet.FilterConfig filterConfig) throws javax.servlet.ServletException
- 指定者:
init
在接口中javax.servlet.Filter
- 抛出:
javax.servlet.ServletException
doFilter
public void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain) throws IOException, javax.servlet.ServletException
- 指定者:
doFilter
在接口中javax.servlet.Filter
- 抛出:
IOException
javax.servlet.ServletException
getDescription
protected String getDescription(javax.servlet.http.HttpServletRequest request)
Return the description for the given request. By default this method will return a description based on the requestservletPath
andpathInfo
.- 参数:
request
- the source request- 返回:
- the description
- 从以下版本开始:
- 1.5.0
addErrorPages
public void addErrorPages(ErrorPage... errorPages)
从接口复制的说明:ErrorPageRegistry
Adds error pages that will be used when handling exceptions.- 指定者:
addErrorPages
在接口中ErrorPageRegistry
- 参数:
errorPages
- the error pages
destroy
public void destroy()
- 指定者:
destroy
在接口中javax.servlet.Filter