@Component @Order(value=-2147483648) public class ErrorPageFilter extends AbstractConfigurableEmbeddedServletContainer implements Filter, NonEmbeddedServletContainerFactory
AbstractConfigurableEmbeddedServletContainer
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 container 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's
EmbeddedServletContainerCustomizer
(any beans of that type in the context will
be applied to this container).Modifier and Type | Field and Description |
---|---|
static String |
ERROR_REQUEST_URI |
Constructor and Description |
---|
ErrorPageFilter() |
Modifier and Type | Method and Description |
---|---|
void |
addErrorPages(ErrorPage... errorPages)
Adds error pages that will be used when handling exceptions.
|
void |
destroy() |
void |
doFilter(ServletRequest request,
ServletResponse response,
FilterChain chain) |
void |
init(FilterConfig filterConfig) |
addInitializers, getAddress, getCompression, getContextPath, getDisplayName, getDocumentRoot, getErrorPages, getJspServlet, getMimeMappings, getPort, getSessionTimeout, getSsl, isPersistSession, isRegisterDefaultServlet, mergeInitializers, setAddress, setCompression, setContextPath, setDisplayName, setDocumentRoot, setErrorPages, setInitializers, setJspServlet, setJspServletClassName, setMimeMappings, setPersistSession, setPort, setRegisterDefaultServlet, setRegisterJspServlet, setSessionTimeout, setSessionTimeout, setSsl, shouldRegisterJspServlet
public static final String ERROR_REQUEST_URI
public void init(FilterConfig filterConfig) throws ServletException
init
in interface Filter
ServletException
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException
doFilter
in interface Filter
IOException
ServletException
public void addErrorPages(ErrorPage... errorPages)
ConfigurableEmbeddedServletContainer
addErrorPages
in interface ConfigurableEmbeddedServletContainer
addErrorPages
in class AbstractConfigurableEmbeddedServletContainer
errorPages
- the error pagesCopyright © 2015 Pivotal Software, Inc.. All rights reserved.