|
30 | 30 | import javax.servlet.http.HttpServletResponse;
|
31 | 31 | import javax.servlet.http.HttpServletResponseWrapper;
|
32 | 32 |
|
33 |
| -import org.springframework.boot.context.embedded.AbstractEmbeddedServletContainerFactory; |
34 |
| -import org.springframework.boot.context.embedded.EmbeddedServletContainer; |
| 33 | +import org.springframework.boot.context.embedded.AbstractConfigurableEmbeddedServletContainer; |
35 | 34 | import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
|
36 |
| -import org.springframework.boot.context.embedded.EmbeddedServletContainerException; |
37 |
| -import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory; |
38 | 35 | import org.springframework.boot.context.embedded.ErrorPage;
|
39 |
| -import org.springframework.boot.context.embedded.ServletContextInitializer; |
40 | 36 | import org.springframework.core.Ordered;
|
41 | 37 | import org.springframework.core.annotation.Order;
|
42 | 38 | import org.springframework.stereotype.Component;
|
43 | 39 |
|
44 | 40 | /**
|
45 |
| - * A special {@link EmbeddedServletContainerFactory} for non-embedded applications (i.e. |
46 |
| - * deployed WAR files). It registers error pages and handles application errors by |
47 |
| - * filtering requests and forwarding to the error pages instead of letting the container |
48 |
| - * handle them. Error pages are a feature of the servlet spec but there is no Java API for |
49 |
| - * registering them in the spec. This filter works around that by accepting error page |
50 |
| - * registrations from Spring Boot's {@link EmbeddedServletContainerCustomizer} (any beans |
51 |
| - * of that type in the context will be applied to this container). |
| 41 | + * A special {@link AbstractConfigurableEmbeddedServletContainer} for non-embedded |
| 42 | + * applications (i.e. deployed WAR files). It registers error pages and handles |
| 43 | + * application errors by filtering requests and forwarding to the error pages instead of |
| 44 | + * letting the container handle them. Error pages are a feature of the servlet spec but |
| 45 | + * there is no Java API for registering them in the spec. This filter works around that by |
| 46 | + * accepting error page registrations from Spring Boot's |
| 47 | + * {@link EmbeddedServletContainerCustomizer} (any beans of that type in the context will |
| 48 | + * be applied to this container). |
52 | 49 | *
|
53 | 50 | * @author Dave Syer
|
54 | 51 | * @author Phillip Webb
|
55 | 52 | */
|
56 | 53 | @Component
|
57 | 54 | @Order(Ordered.HIGHEST_PRECEDENCE)
|
58 |
| -public class ErrorWrapperEmbeddedServletContainerFactory extends |
59 |
| - AbstractEmbeddedServletContainerFactory implements Filter { |
| 55 | +class ErrorPageFilter extends AbstractConfigurableEmbeddedServletContainer implements |
| 56 | + Filter { |
60 | 57 |
|
61 | 58 | // From RequestDispatcher but not referenced to remain compatible with Servlet 2.5
|
62 | 59 |
|
@@ -161,28 +158,6 @@ private void rethrow(Throwable ex) throws IOException, ServletException {
|
161 | 158 | throw new IllegalStateException(ex);
|
162 | 159 | }
|
163 | 160 |
|
164 |
| - @Override |
165 |
| - public EmbeddedServletContainer getEmbeddedServletContainer( |
166 |
| - ServletContextInitializer... initializers) { |
167 |
| - |
168 |
| - return new EmbeddedServletContainer() { |
169 |
| - |
170 |
| - @Override |
171 |
| - public void start() throws EmbeddedServletContainerException { |
172 |
| - } |
173 |
| - |
174 |
| - @Override |
175 |
| - public void stop() throws EmbeddedServletContainerException { |
176 |
| - } |
177 |
| - |
178 |
| - @Override |
179 |
| - public int getPort() { |
180 |
| - return -1; |
181 |
| - } |
182 |
| - }; |
183 |
| - |
184 |
| - } |
185 |
| - |
186 | 161 | @Override
|
187 | 162 | public void addErrorPages(ErrorPage... errorPages) {
|
188 | 163 | for (ErrorPage errorPage : errorPages) {
|
|
0 commit comments