|
|
|
@ -38,6 +38,7 @@ import org.springframework.boot.context.embedded.ErrorPage;
|
|
|
|
|
import org.springframework.core.Ordered;
|
|
|
|
|
import org.springframework.core.annotation.Order;
|
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
import org.springframework.web.filter.OncePerRequestFilter;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* A special {@link AbstractConfigurableEmbeddedServletContainer} for non-embedded
|
|
|
|
@ -76,21 +77,28 @@ class ErrorPageFilter extends AbstractConfigurableEmbeddedServletContainer imple
|
|
|
|
|
private final Map<Class<?>, String> exceptions = new HashMap<Class<?>, String>();
|
|
|
|
|
|
|
|
|
|
private final Map<Class<?>, Class<?>> subtypes = new HashMap<Class<?>, Class<?>>();
|
|
|
|
|
|
|
|
|
|
private final OncePerRequestFilter delegate = new OncePerRequestFilter(
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void doFilterInternal(HttpServletRequest request,
|
|
|
|
|
HttpServletResponse response, FilterChain chain)
|
|
|
|
|
throws ServletException, IOException {
|
|
|
|
|
ErrorPageFilter.this.doFilter(request, response, chain);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void init(FilterConfig filterConfig) throws ServletException {
|
|
|
|
|
delegate.init(filterConfig);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void doFilter(ServletRequest request, ServletResponse response,
|
|
|
|
|
FilterChain chain) throws IOException, ServletException {
|
|
|
|
|
if (request instanceof HttpServletRequest
|
|
|
|
|
&& response instanceof HttpServletResponse) {
|
|
|
|
|
doFilter((HttpServletRequest) request, (HttpServletResponse) response, chain);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
chain.doFilter(request, response);
|
|
|
|
|
}
|
|
|
|
|
delegate.doFilter(request, response, chain);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void doFilter(HttpServletRequest request, HttpServletResponse response,
|
|
|
|
|