use of org.springframework.boot.web.servlet.ServletRegistrationBean in project spring-boot by spring-projects.
the class ServletWebServerApplicationContextTests method servletContextInitializerBeansSkipsRegisteredServletsAndFilters.
@Test
public void servletContextInitializerBeansSkipsRegisteredServletsAndFilters() throws Exception {
addWebServerFactoryBean();
Servlet servlet = mock(Servlet.class);
Filter filter = mock(Filter.class);
ServletRegistrationBean<Servlet> initializer = new ServletRegistrationBean<>(servlet, "/foo");
this.context.registerBeanDefinition("initializerBean", beanDefinition(initializer));
this.context.registerBeanDefinition("servletBean", beanDefinition(servlet));
this.context.registerBeanDefinition("filterBean", beanDefinition(filter));
this.context.refresh();
ServletContext servletContext = getWebServerFactory().getServletContext();
verify(servletContext, atMost(1)).addServlet(anyString(), (Servlet) any());
verify(servletContext, atMost(1)).addFilter(anyString(), (Filter) any());
}
use of org.springframework.boot.web.servlet.ServletRegistrationBean in project camel by apache.
the class HystrixMappingAutoConfiguration method servletRegistrationBean.
@Bean
ServletRegistrationBean servletRegistrationBean(HystrixMappingConfiguration config) {
ServletRegistrationBean mapping = new ServletRegistrationBean();
mapping.setServlet(new HystrixEventStreamServlet());
mapping.addUrlMappings(config.getPath());
mapping.setName(config.getServletName());
return mapping;
}
use of org.springframework.boot.web.servlet.ServletRegistrationBean in project camel by apache.
the class Application method servletRegistrationBean.
@Bean
ServletRegistrationBean servletRegistrationBean() {
ServletRegistrationBean servlet = new ServletRegistrationBean(new CamelHttpTransportServlet(), "/camel-rest-jpa/*");
servlet.setName("CamelServlet");
return servlet;
}
use of org.springframework.boot.web.servlet.ServletRegistrationBean in project libresonic by Libresonic.
the class Application method dwrServletRegistrationBean.
/**
* Registers the DWR servlet.
*
* @return a registration bean.
*/
@Bean
public ServletRegistrationBean dwrServletRegistrationBean() {
ServletRegistrationBean servlet = new ServletRegistrationBean(new DwrServlet(), "/dwr/*");
servlet.addInitParameter("crossDomainSessionSecurity", "false");
return servlet;
}
use of org.springframework.boot.web.servlet.ServletRegistrationBean in project springboot_op by SnailFastGo.
the class DruidConfiguration method statViewServlet.
@Bean
public ServletRegistrationBean statViewServlet() {
//创建servlet注册实体
ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new StatViewServlet(), "/druid/*");
//设置ip白名单
servletRegistrationBean.addInitParameter("allow", "127.0.0.1");
//设置ip黑名单,如果allow与deny共同存在时,deny优先于allow
servletRegistrationBean.addInitParameter("deny", "192.168.0.19");
//设置控制台管理用户
servletRegistrationBean.addInitParameter("loginUsername", "druid");
servletRegistrationBean.addInitParameter("loginPassword", "123456");
//是否可以重置数据
servletRegistrationBean.addInitParameter("resetEnable", "false");
return servletRegistrationBean;
}
Aggregations