Browse Source

Move Servlet Filters into spring-boot-servlet

Closes gh-46151
pull/46230/head
Andy Wilkinson 8 months ago
parent
commit
ff73a4d0bb
  1. 4
      spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/web/servlet/FilterOrderingIntegrationTests.java
  2. 1
      spring-boot-project/spring-boot-freemarker/build.gradle
  3. 2
      spring-boot-project/spring-boot-freemarker/src/test/java/org/springframework/boot/freemarker/autoconfigure/FreeMarkerAutoConfigurationServletIntegrationTests.java
  4. 2
      spring-boot-project/spring-boot-security/src/main/java/org/springframework/boot/security/autoconfigure/SecurityProperties.java
  5. 2
      spring-boot-project/spring-boot-security/src/test/java/org/springframework/boot/security/autoconfigure/servlet/SecurityAutoConfigurationTests.java
  6. 2
      spring-boot-project/spring-boot-servlet/src/main/java/org/springframework/boot/servlet/actuate/autoconfigure/ServletManagementContextAutoConfiguration.java
  7. 2
      spring-boot-project/spring-boot-servlet/src/main/java/org/springframework/boot/servlet/autoconfigure/HttpEncodingAutoConfiguration.java
  8. 4
      spring-boot-project/spring-boot-servlet/src/main/java/org/springframework/boot/servlet/filter/ApplicationContextHeaderFilter.java
  9. 4
      spring-boot-project/spring-boot-servlet/src/main/java/org/springframework/boot/servlet/filter/OrderedCharacterEncodingFilter.java
  10. 4
      spring-boot-project/spring-boot-servlet/src/main/java/org/springframework/boot/servlet/filter/OrderedFilter.java
  11. 4
      spring-boot-project/spring-boot-servlet/src/main/java/org/springframework/boot/servlet/filter/OrderedFormContentFilter.java
  12. 4
      spring-boot-project/spring-boot-servlet/src/main/java/org/springframework/boot/servlet/filter/OrderedHiddenHttpMethodFilter.java
  13. 4
      spring-boot-project/spring-boot-servlet/src/main/java/org/springframework/boot/servlet/filter/OrderedRequestContextFilter.java
  14. 2
      spring-boot-project/spring-boot-servlet/src/main/java/org/springframework/boot/servlet/filter/package-info.java
  15. 4
      spring-boot-project/spring-boot-servlet/src/test/java/org/springframework/boot/servlet/autoconfigure/HttpEncodingAutoConfigurationTests.java
  16. 2
      spring-boot-project/spring-boot-thymeleaf/src/test/java/org/springframework/boot/thymeleaf/autoconfigure/ThymeleafServletAutoConfigurationTests.java
  17. 2
      spring-boot-project/spring-boot-webmvc/src/main/java/org/springframework/boot/webmvc/actuate/autoconfigure/web/WebMvcEndpointChildContextConfiguration.java
  18. 6
      spring-boot-project/spring-boot-webmvc/src/main/java/org/springframework/boot/webmvc/autoconfigure/WebMvcAutoConfiguration.java
  19. 2
      spring-boot-project/spring-boot-webmvc/src/test/java/org/springframework/boot/webmvc/actuate/autoconfigure/web/WebMvcEndpointChildContextConfigurationTests.java
  20. 2
      spring-boot-project/spring-boot-webmvc/src/test/java/org/springframework/boot/webmvc/autoconfigure/WebMvcAutoConfigurationTests.java

4
spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/web/servlet/FilterOrderingIntegrationTests.java

@ -27,14 +27,14 @@ import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoCon @@ -27,14 +27,14 @@ import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoCon
import org.springframework.boot.http.converter.autoconfigure.HttpMessageConvertersAutoConfiguration;
import org.springframework.boot.security.autoconfigure.servlet.SecurityAutoConfiguration;
import org.springframework.boot.servlet.autoconfigure.HttpEncodingAutoConfiguration;
import org.springframework.boot.servlet.filter.OrderedCharacterEncodingFilter;
import org.springframework.boot.servlet.filter.OrderedRequestContextFilter;
import org.springframework.boot.session.autoconfigure.SessionAutoConfiguration;
import org.springframework.boot.test.util.TestPropertyValues;
import org.springframework.boot.web.server.WebServerFactoryCustomizerBeanPostProcessor;
import org.springframework.boot.web.server.servlet.MockServletWebServer.RegisteredFilter;
import org.springframework.boot.web.server.servlet.MockServletWebServerFactory;
import org.springframework.boot.web.server.servlet.context.AnnotationConfigServletWebServerApplicationContext;
import org.springframework.boot.web.servlet.filter.OrderedCharacterEncodingFilter;
import org.springframework.boot.web.servlet.filter.OrderedRequestContextFilter;
import org.springframework.boot.webmvc.autoconfigure.WebMvcAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

1
spring-boot-project/spring-boot-freemarker/build.gradle

@ -35,6 +35,7 @@ dependencies { @@ -35,6 +35,7 @@ dependencies {
optional("org.springframework:spring-webflux")
optional("jakarta.servlet:jakarta.servlet-api")
testImplementation(project(":spring-boot-project:spring-boot-servlet"))
testImplementation(project(":spring-boot-project:spring-boot-test"))
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))

2
spring-boot-project/spring-boot-freemarker/src/test/java/org/springframework/boot/freemarker/autoconfigure/FreeMarkerAutoConfigurationServletIntegrationTests.java

@ -28,11 +28,11 @@ import org.junit.jupiter.api.Test; @@ -28,11 +28,11 @@ import org.junit.jupiter.api.Test;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
import org.springframework.boot.servlet.filter.OrderedCharacterEncodingFilter;
import org.springframework.boot.test.util.TestPropertyValues;
import org.springframework.boot.testsupport.classpath.resources.WithResource;
import org.springframework.boot.web.context.servlet.AnnotationConfigServletWebApplicationContext;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.filter.OrderedCharacterEncodingFilter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

2
spring-boot-project/spring-boot-security/src/main/java/org/springframework/boot/security/autoconfigure/SecurityProperties.java

@ -23,8 +23,8 @@ import java.util.Set; @@ -23,8 +23,8 @@ import java.util.Set;
import java.util.UUID;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.servlet.filter.OrderedFilter;
import org.springframework.boot.web.servlet.DispatcherType;
import org.springframework.boot.web.servlet.filter.OrderedFilter;
import org.springframework.core.Ordered;
import org.springframework.util.StringUtils;

2
spring-boot-project/spring-boot-security/src/test/java/org/springframework/boot/security/autoconfigure/servlet/SecurityAutoConfigurationTests.java

@ -37,11 +37,11 @@ import org.springframework.boot.convert.ApplicationConversionService; @@ -37,11 +37,11 @@ import org.springframework.boot.convert.ApplicationConversionService;
import org.springframework.boot.jdbc.autoconfigure.DataSourceAutoConfiguration;
import org.springframework.boot.jpa.autoconfigure.hibernate.HibernateJpaAutoConfiguration;
import org.springframework.boot.security.autoconfigure.jpa.City;
import org.springframework.boot.servlet.filter.OrderedFilter;
import org.springframework.boot.test.context.FilteredClassLoader;
import org.springframework.boot.test.context.runner.WebApplicationContextRunner;
import org.springframework.boot.testsupport.classpath.resources.WithResource;
import org.springframework.boot.web.servlet.DelegatingFilterProxyRegistrationBean;
import org.springframework.boot.web.servlet.filter.OrderedFilter;
import org.springframework.boot.webmvc.autoconfigure.WebMvcAutoConfiguration;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;

2
spring-boot-project/spring-boot-servlet/src/main/java/org/springframework/boot/servlet/actuate/autoconfigure/ServletManagementContextAutoConfiguration.java

@ -26,7 +26,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; @@ -26,7 +26,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.servlet.filter.ApplicationContextHeaderFilter;
import org.springframework.boot.servlet.filter.ApplicationContextHeaderFilter;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

2
spring-boot-project/spring-boot-servlet/src/main/java/org/springframework/boot/servlet/autoconfigure/HttpEncodingAutoConfiguration.java

@ -23,7 +23,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; @@ -23,7 +23,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.servlet.filter.OrderedCharacterEncodingFilter;
import org.springframework.boot.servlet.filter.OrderedCharacterEncodingFilter;
import org.springframework.context.annotation.Bean;
import org.springframework.web.filter.CharacterEncodingFilter;

4
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/filter/ApplicationContextHeaderFilter.java → spring-boot-project/spring-boot-servlet/src/main/java/org/springframework/boot/servlet/filter/ApplicationContextHeaderFilter.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.web.servlet.filter;
package org.springframework.boot.servlet.filter;
import java.io.IOException;
@ -32,7 +32,7 @@ import org.springframework.web.filter.OncePerRequestFilter; @@ -32,7 +32,7 @@ import org.springframework.web.filter.OncePerRequestFilter;
*
* @author Phillip Webb
* @author Venil Noronha
* @since 2.0.0
* @since 4.0.0
*/
public class ApplicationContextHeaderFilter extends OncePerRequestFilter {

4
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/filter/OrderedCharacterEncodingFilter.java → spring-boot-project/spring-boot-servlet/src/main/java/org/springframework/boot/servlet/filter/OrderedCharacterEncodingFilter.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.web.servlet.filter;
package org.springframework.boot.servlet.filter;
import org.springframework.core.Ordered;
import org.springframework.web.filter.CharacterEncodingFilter;
@ -23,7 +23,7 @@ import org.springframework.web.filter.CharacterEncodingFilter; @@ -23,7 +23,7 @@ import org.springframework.web.filter.CharacterEncodingFilter;
* {@link CharacterEncodingFilter} that also implements {@link Ordered}.
*
* @author Phillip Webb
* @since 2.0.0
* @since 4.0.0
*/
public class OrderedCharacterEncodingFilter extends CharacterEncodingFilter implements OrderedFilter {

4
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/filter/OrderedFilter.java → spring-boot-project/spring-boot-servlet/src/main/java/org/springframework/boot/servlet/filter/OrderedFilter.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.web.servlet.filter;
package org.springframework.boot.servlet.filter;
import jakarta.servlet.Filter;
@ -24,7 +24,7 @@ import org.springframework.core.Ordered; @@ -24,7 +24,7 @@ import org.springframework.core.Ordered;
* An {@link Ordered} {@link jakarta.servlet.Filter}.
*
* @author Phillip Webb
* @since 2.1.0
* @since 4.0.0
*/
public interface OrderedFilter extends Filter, Ordered {

4
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/filter/OrderedFormContentFilter.java → spring-boot-project/spring-boot-servlet/src/main/java/org/springframework/boot/servlet/filter/OrderedFormContentFilter.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.web.servlet.filter;
package org.springframework.boot.servlet.filter;
import org.springframework.core.Ordered;
import org.springframework.web.filter.FormContentFilter;
@ -24,7 +24,7 @@ import org.springframework.web.filter.FormContentFilter; @@ -24,7 +24,7 @@ import org.springframework.web.filter.FormContentFilter;
*
* @author Joao Pedro Evangelista
* @author Brian Clozel
* @since 2.1.0
* @since 4.0.0
*/
public class OrderedFormContentFilter extends FormContentFilter implements OrderedFilter {

4
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/filter/OrderedHiddenHttpMethodFilter.java → spring-boot-project/spring-boot-servlet/src/main/java/org/springframework/boot/servlet/filter/OrderedHiddenHttpMethodFilter.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.web.servlet.filter;
package org.springframework.boot.servlet.filter;
import org.springframework.core.Ordered;
import org.springframework.web.filter.HiddenHttpMethodFilter;
@ -23,7 +23,7 @@ import org.springframework.web.filter.HiddenHttpMethodFilter; @@ -23,7 +23,7 @@ import org.springframework.web.filter.HiddenHttpMethodFilter;
* {@link HiddenHttpMethodFilter} that also implements {@link Ordered}.
*
* @author Phillip Webb
* @since 2.0.0
* @since 4.0.0
*/
public class OrderedHiddenHttpMethodFilter extends HiddenHttpMethodFilter implements OrderedFilter {

4
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/filter/OrderedRequestContextFilter.java → spring-boot-project/spring-boot-servlet/src/main/java/org/springframework/boot/servlet/filter/OrderedRequestContextFilter.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.web.servlet.filter;
package org.springframework.boot.servlet.filter;
import org.springframework.core.Ordered;
import org.springframework.web.filter.RequestContextFilter;
@ -23,7 +23,7 @@ import org.springframework.web.filter.RequestContextFilter; @@ -23,7 +23,7 @@ import org.springframework.web.filter.RequestContextFilter;
* {@link RequestContextFilter} that also implements {@link Ordered}.
*
* @author Phillip Webb
* @since 2.0.0
* @since 4.0.0
*/
public class OrderedRequestContextFilter extends RequestContextFilter implements OrderedFilter {

2
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/filter/package-info.java → spring-boot-project/spring-boot-servlet/src/main/java/org/springframework/boot/servlet/filter/package-info.java

@ -17,4 +17,4 @@ @@ -17,4 +17,4 @@
/**
* Spring Boot specific {@link jakarta.servlet.Filter} implementations.
*/
package org.springframework.boot.web.servlet.filter;
package org.springframework.boot.servlet.filter;

4
spring-boot-project/spring-boot-servlet/src/test/java/org/springframework/boot/servlet/autoconfigure/HttpEncodingAutoConfigurationTests.java

@ -24,10 +24,10 @@ import org.junit.jupiter.api.AfterEach; @@ -24,10 +24,10 @@ import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.boot.servlet.filter.OrderedFormContentFilter;
import org.springframework.boot.servlet.filter.OrderedHiddenHttpMethodFilter;
import org.springframework.boot.test.util.TestPropertyValues;
import org.springframework.boot.web.context.servlet.AnnotationConfigServletWebApplicationContext;
import org.springframework.boot.web.servlet.filter.OrderedFormContentFilter;
import org.springframework.boot.web.servlet.filter.OrderedHiddenHttpMethodFilter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.AnnotationAwareOrderComparator;

2
spring-boot-project/spring-boot-thymeleaf/src/test/java/org/springframework/boot/thymeleaf/autoconfigure/ThymeleafServletAutoConfigurationTests.java

@ -44,6 +44,7 @@ import org.thymeleaf.templateresolver.ITemplateResolver; @@ -44,6 +44,7 @@ import org.thymeleaf.templateresolver.ITemplateResolver;
import org.thymeleaf.web.servlet.JakartaServletWebApplication;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.servlet.filter.OrderedCharacterEncodingFilter;
import org.springframework.boot.test.context.FilteredClassLoader;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.boot.test.context.runner.WebApplicationContextRunner;
@ -51,7 +52,6 @@ import org.springframework.boot.test.system.CapturedOutput; @@ -51,7 +52,6 @@ import org.springframework.boot.test.system.CapturedOutput;
import org.springframework.boot.test.system.OutputCaptureExtension;
import org.springframework.boot.testsupport.classpath.resources.WithResource;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.filter.OrderedCharacterEncodingFilter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.mock.web.MockHttpServletRequest;

2
spring-boot-project/spring-boot-webmvc/src/main/java/org/springframework/boot/webmvc/actuate/autoconfigure/web/WebMvcEndpointChildContextConfiguration.java

@ -24,11 +24,11 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; @@ -24,11 +24,11 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type;
import org.springframework.boot.servlet.filter.OrderedRequestContextFilter;
import org.springframework.boot.web.error.ErrorPage;
import org.springframework.boot.web.server.WebServerFactoryCustomizer;
import org.springframework.boot.web.server.autoconfigure.ServerProperties;
import org.springframework.boot.web.server.servlet.ConfigurableServletWebServerFactory;
import org.springframework.boot.web.servlet.filter.OrderedRequestContextFilter;
import org.springframework.boot.webmvc.autoconfigure.DispatcherServletAutoConfiguration;
import org.springframework.boot.webmvc.autoconfigure.DispatcherServletRegistrationBean;
import org.springframework.boot.webmvc.error.ErrorAttributes;

6
spring-boot-project/spring-boot-webmvc/src/main/java/org/springframework/boot/webmvc/autoconfigure/WebMvcAutoConfiguration.java

@ -52,11 +52,11 @@ import org.springframework.boot.autoconfigure.web.format.WebConversionService; @@ -52,11 +52,11 @@ import org.springframework.boot.autoconfigure.web.format.WebConversionService;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.convert.ApplicationConversionService;
import org.springframework.boot.http.converter.autoconfigure.HttpMessageConverters;
import org.springframework.boot.servlet.filter.OrderedFormContentFilter;
import org.springframework.boot.servlet.filter.OrderedHiddenHttpMethodFilter;
import org.springframework.boot.servlet.filter.OrderedRequestContextFilter;
import org.springframework.boot.validation.autoconfigure.ValidatorAdapter;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.boot.web.servlet.filter.OrderedFormContentFilter;
import org.springframework.boot.web.servlet.filter.OrderedHiddenHttpMethodFilter;
import org.springframework.boot.web.servlet.filter.OrderedRequestContextFilter;
import org.springframework.boot.webmvc.autoconfigure.WebMvcProperties.Format;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ResourceLoaderAware;

2
spring-boot-project/spring-boot-webmvc/src/test/java/org/springframework/boot/webmvc/actuate/autoconfigure/web/WebMvcEndpointChildContextConfigurationTests.java

@ -18,8 +18,8 @@ package org.springframework.boot.webmvc.actuate.autoconfigure.web; @@ -18,8 +18,8 @@ package org.springframework.boot.webmvc.actuate.autoconfigure.web;
import org.junit.jupiter.api.Test;
import org.springframework.boot.servlet.filter.OrderedRequestContextFilter;
import org.springframework.boot.test.context.runner.WebApplicationContextRunner;
import org.springframework.boot.web.servlet.filter.OrderedRequestContextFilter;
import org.springframework.boot.webmvc.autoconfigure.DispatcherServletPath;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

2
spring-boot-project/spring-boot-webmvc/src/test/java/org/springframework/boot/webmvc/autoconfigure/WebMvcAutoConfigurationTests.java

@ -48,6 +48,7 @@ import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoCon @@ -48,6 +48,7 @@ import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoCon
import org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration;
import org.springframework.boot.http.converter.autoconfigure.HttpMessageConverters;
import org.springframework.boot.http.converter.autoconfigure.HttpMessageConvertersAutoConfiguration;
import org.springframework.boot.servlet.filter.OrderedFormContentFilter;
import org.springframework.boot.test.context.assertj.AssertableWebApplicationContext;
import org.springframework.boot.test.context.runner.ContextConsumer;
import org.springframework.boot.test.context.runner.WebApplicationContextRunner;
@ -61,7 +62,6 @@ import org.springframework.boot.web.server.servlet.ServletWebServerFactory; @@ -61,7 +62,6 @@ import org.springframework.boot.web.server.servlet.ServletWebServerFactory;
import org.springframework.boot.web.server.servlet.context.AnnotationConfigServletWebServerApplicationContext;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.boot.web.servlet.filter.OrderedFormContentFilter;
import org.springframework.boot.webmvc.autoconfigure.WebMvcAutoConfiguration.WebMvcAutoConfigurationAdapter;
import org.springframework.boot.webmvc.autoconfigure.WebMvcAutoConfigurationTests.OrderedControllerAdviceBeansConfiguration.HighestOrderedControllerAdvice;
import org.springframework.boot.webmvc.autoconfigure.WebMvcAutoConfigurationTests.OrderedControllerAdviceBeansConfiguration.LowestOrderedControllerAdvice;

Loading…
Cancel
Save