use of org.springframework.web.servlet.resource.ResourceUrlEncodingFilter in project spring-boot by spring-projects.
the class ThymeleafServletAutoConfigurationTests method registerResourceHandlingFilterWithResourceRegistrationBean.
@Test
@SuppressWarnings("rawtypes")
void registerResourceHandlingFilterWithResourceRegistrationBean() {
// gh-14926
this.contextRunner.withUserConfiguration(FilterRegistrationResourceConfiguration.class).withPropertyValues("spring.web.resources.chain.enabled:true").run((context) -> {
Map<String, FilterRegistrationBean> beans = context.getBeansOfType(FilterRegistrationBean.class);
assertThat(beans).hasSize(1);
FilterRegistrationBean registration = beans.values().stream().filter((r) -> r.getFilter() instanceof ResourceUrlEncodingFilter).findFirst().get();
assertThat(registration).hasFieldOrPropertyWithValue("dispatcherTypes", EnumSet.of(DispatcherType.INCLUDE));
});
}
use of org.springframework.web.servlet.resource.ResourceUrlEncodingFilter in project spring-boot by spring-projects.
the class FreeMarkerServletWebConfiguration method resourceUrlEncodingFilter.
@Bean
@ConditionalOnEnabledResourceChain
@ConditionalOnMissingFilterBean(ResourceUrlEncodingFilter.class)
FilterRegistrationBean<ResourceUrlEncodingFilter> resourceUrlEncodingFilter() {
FilterRegistrationBean<ResourceUrlEncodingFilter> registration = new FilterRegistrationBean<>(new ResourceUrlEncodingFilter());
registration.setDispatcherTypes(DispatcherType.REQUEST, DispatcherType.ERROR);
return registration;
}
use of org.springframework.web.servlet.resource.ResourceUrlEncodingFilter in project spring-boot by spring-projects.
the class FreeMarkerAutoConfigurationServletIntegrationTests method registerResourceHandlingFilterWithResourceRegistrationBean.
@Test
@SuppressWarnings("rawtypes")
void registerResourceHandlingFilterWithResourceRegistrationBean() {
// gh-14926
load(FilterRegistrationResourceConfiguration.class, "spring.web.resources.chain.enabled:true");
Map<String, FilterRegistrationBean> beans = this.context.getBeansOfType(FilterRegistrationBean.class);
assertThat(beans).hasSize(1);
FilterRegistrationBean registration = beans.values().stream().filter((r) -> r.getFilter() instanceof ResourceUrlEncodingFilter).findFirst().get();
assertThat(registration).hasFieldOrPropertyWithValue("dispatcherTypes", EnumSet.of(DispatcherType.INCLUDE));
}
use of org.springframework.web.servlet.resource.ResourceUrlEncodingFilter in project spring-boot by spring-projects.
the class FreeMarkerAutoConfigurationServletIntegrationTests method registerResourceHandlingFilterWithOtherRegistrationBean.
@Test
@SuppressWarnings("rawtypes")
void registerResourceHandlingFilterWithOtherRegistrationBean() {
// gh-14897
load(FilterRegistrationOtherConfiguration.class, "spring.web.resources.chain.enabled:true");
Map<String, FilterRegistrationBean> beans = this.context.getBeansOfType(FilterRegistrationBean.class);
assertThat(beans).hasSize(2);
FilterRegistrationBean registration = beans.values().stream().filter((r) -> r.getFilter() instanceof ResourceUrlEncodingFilter).findFirst().get();
assertThat(registration).hasFieldOrPropertyWithValue("dispatcherTypes", EnumSet.of(DispatcherType.REQUEST, DispatcherType.ERROR));
}
use of org.springframework.web.servlet.resource.ResourceUrlEncodingFilter in project spring-boot by spring-projects.
the class ThymeleafServletAutoConfigurationTests method registerResourceHandlingFilterWithOtherRegistrationBean.
@Test
@SuppressWarnings("rawtypes")
void registerResourceHandlingFilterWithOtherRegistrationBean() {
// gh-14897
this.contextRunner.withUserConfiguration(FilterRegistrationOtherConfiguration.class).withPropertyValues("spring.web.resources.chain.enabled:true").run((context) -> {
Map<String, FilterRegistrationBean> beans = context.getBeansOfType(FilterRegistrationBean.class);
assertThat(beans).hasSize(2);
FilterRegistrationBean registration = beans.values().stream().filter((r) -> r.getFilter() instanceof ResourceUrlEncodingFilter).findFirst().get();
assertThat(registration).hasFieldOrPropertyWithValue("dispatcherTypes", EnumSet.of(DispatcherType.REQUEST, DispatcherType.ERROR));
});
}
Aggregations