use of org.springframework.boot.web.servlet.FilterRegistrationBean in project spring-boot by spring-projects.
the class ServletWebServerApplicationContextTests method filterRegistrationBeansSkipsRegisteredFilters.
@Test
public void filterRegistrationBeansSkipsRegisteredFilters() throws Exception {
addWebServerFactoryBean();
Filter filter = mock(Filter.class);
FilterRegistrationBean<Filter> initializer = new FilterRegistrationBean<>(filter);
this.context.registerBeanDefinition("initializerBean", beanDefinition(initializer));
this.context.registerBeanDefinition("filterBean", beanDefinition(filter));
this.context.refresh();
ServletContext servletContext = getWebServerFactory().getServletContext();
verify(servletContext, atMost(1)).addFilter(anyString(), (Filter) any());
}
use of org.springframework.boot.web.servlet.FilterRegistrationBean in project spring-boot by spring-projects.
the class JerseyAutoConfiguration method jerseyFilterRegistration.
@Bean
@ConditionalOnMissingBean(name = "jerseyFilterRegistration")
@ConditionalOnProperty(prefix = "spring.jersey", name = "type", havingValue = "filter")
public FilterRegistrationBean<ServletContainer> jerseyFilterRegistration() {
FilterRegistrationBean<ServletContainer> registration = new FilterRegistrationBean<>();
registration.setFilter(new ServletContainer(this.config));
registration.setUrlPatterns(Arrays.asList(this.path));
registration.setOrder(this.jersey.getFilter().getOrder());
registration.addInitParameter(ServletProperties.FILTER_CONTEXT_PATH, stripPattern(this.path));
addInitParameters(registration);
registration.setName("jerseyFilter");
registration.setDispatcherTypes(EnumSet.allOf(DispatcherType.class));
return registration;
}
use of org.springframework.boot.web.servlet.FilterRegistrationBean in project spring-boot by spring-projects.
the class JerseyAutoConfiguration method requestContextFilter.
@Bean
@ConditionalOnMissingBean
public FilterRegistrationBean<RequestContextFilter> requestContextFilter() {
FilterRegistrationBean<RequestContextFilter> registration = new FilterRegistrationBean<>();
registration.setFilter(new RequestContextFilter());
registration.setOrder(this.jersey.getFilter().getOrder() - 1);
registration.setName("requestContextFilter");
return registration;
}
use of org.springframework.boot.web.servlet.FilterRegistrationBean in project libresonic by Libresonic.
the class Application method restFilterRegistration.
@Bean
public FilterRegistrationBean restFilterRegistration() {
FilterRegistrationBean registration = new FilterRegistrationBean();
registration.setFilter(restFilter());
registration.addUrlPatterns("/rest/*");
registration.setName("RESTFilter");
registration.setOrder(3);
return registration;
}
use of org.springframework.boot.web.servlet.FilterRegistrationBean in project libresonic by Libresonic.
the class Application method metricsFilterRegistration.
@Bean
public FilterRegistrationBean metricsFilterRegistration() {
FilterRegistrationBean registration = new FilterRegistrationBean();
registration.setFilter(metricsFilter());
registration.setOrder(7);
return registration;
}
Aggregations