Java Code Examples for org.springframework.boot.web.servlet.ServletRegistrationBean#setName()

The following examples show how to use org.springframework.boot.web.servlet.ServletRegistrationBean#setName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HystrixConfiguration.java    From springcloud-course with GNU General Public License v3.0 5 votes vote down vote up
@Bean(name = "hystrixRegistrationBean")
public ServletRegistrationBean servletRegistrationBean() {
    ServletRegistrationBean registration = new ServletRegistrationBean(
            new HystrixMetricsStreamServlet(), "/hystrix.stream");
    registration.setName("hystrixServlet");
    registration.setLoadOnStartup(1);
    return registration;
}
 
Example 2
Source File: Application.java    From basic with MIT License 5 votes vote down vote up
@Bean
public ServletRegistrationBean apiServletBean(WebApplicationContext webApplicationContext) {
    DispatcherServlet servlet = new DispatcherServlet(webApplicationContext);
    ServletRegistrationBean bean = new ServletRegistrationBean(servlet, "/api/*");
    bean.setName("ApiServlet");
    return bean;
}
 
Example 3
Source File: Application.java    From camel-cookbook-examples with Apache License 2.0 5 votes vote down vote up
@Bean
public ServletRegistrationBean servletRegistrationBean() {
    ServletRegistrationBean registration =
            new ServletRegistrationBean(new CamelHttpTransportServlet(), CAMEL_URL_MAPPING);
    registration.setName(CAMEL_SERVLET_NAME);
    return registration;
}
 
Example 4
Source File: HystrixServlet.java    From springcloud-study with Apache License 2.0 5 votes vote down vote up
/**
	 *  指定 hystrix 的路径
	 * @return
	 */
	@SuppressWarnings({ "rawtypes", "unchecked" })
//	@Bean
    public ServletRegistrationBean getServlet() {
        HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();
        ServletRegistrationBean registrationBean = new ServletRegistrationBean(streamServlet);
        registrationBean.setLoadOnStartup(1);
        registrationBean.addUrlMappings("/hystrix.stream");
        registrationBean.setName("HystrixMetricsStreamServlet");
        return registrationBean;
    }
 
Example 5
Source File: CCRIFHIRServer.java    From careconnect-reference-implementation with Apache License 2.0 5 votes vote down vote up
@Bean
public ServletRegistrationBean servletRegistrationR4Bean() {
    ServletRegistrationBean registration = new ServletRegistrationBean(new JpaRestfulServerR4(context), "/R4/*");
    registration.setName("FhirServletR4");
    registration.setLoadOnStartup(2);
    return registration;
}
 
Example 6
Source File: HystrixConfiguration.java    From springcloud-course with GNU General Public License v3.0 5 votes vote down vote up
@Bean(name = "hystrixForTurbineRegistrationBean")
public ServletRegistrationBean servletTurbineRegistrationBean() {
    ServletRegistrationBean registration = new ServletRegistrationBean(
            new HystrixMetricsStreamServlet(), "/actuator/hystrix.stream");
    registration.setName("hystrixForTurbineServlet");
    registration.setLoadOnStartup(1);
    return registration;
}
 
Example 7
Source File: RubricsApplication.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
@Bean
public ServletRegistrationBean rubricsServlet() {
    ServletRegistrationBean srb = new ServletRegistrationBean(new DispatcherServlet(new AnnotationConfigWebApplicationContext())) {
        @Override
        public void onStartup(ServletContext servletContext) throws ServletException {
            super.onStartup(servletContext);
            servletContext.addListener(ToolListener.class);
            // servletContext.addListener(SakaiContextLoaderListener.class);
        }
    };
    srb.setName("sakai.rubrics");
    srb.setLoadOnStartup(0);
    srb.addUrlMappings("/", "/index");
    return srb;
}
 
Example 8
Source File: HystrixConfiguration.java    From springcloud-course with GNU General Public License v3.0 5 votes vote down vote up
@Bean(name = "hystrixRegistrationBean")
public ServletRegistrationBean servletRegistrationBean() {
    ServletRegistrationBean registration = new ServletRegistrationBean(
            new HystrixMetricsStreamServlet(), "/hystrix.stream");
    registration.setName("hystrixServlet");
    registration.setLoadOnStartup(1);
    return registration;
}
 
Example 9
Source File: OIDCClientAgentContext.java    From syncope with Apache License 2.0 5 votes vote down vote up
@Bean
public ServletRegistrationBean<Login> oidcClientLogin() {
    ServletRegistrationBean<Login> bean = new ServletRegistrationBean<>(
            new Login(ctx, anonymousUser, anonymousKey, useGZIPCompression), "/oidcclient/login");
    bean.setName("oidcClientLogin");
    return bean;
}
 
Example 10
Source File: ActivitiUIApplication.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
@Bean
public ServletRegistrationBean appDispatcher() {
    DispatcherServlet api = new DispatcherServlet();
    api.setContextClass(AnnotationConfigWebApplicationContext.class);
    api.setContextConfigLocation(AppDispatcherServletConfiguration.class.getName());
    ServletRegistrationBean registrationBean = new ServletRegistrationBean();
    registrationBean.setServlet(api);
    registrationBean.addUrlMappings("/app/*"); // app下面的所有内容都访问到这里
    registrationBean.setLoadOnStartup(1);
    registrationBean.setAsyncSupported(true);
    registrationBean.setName("app"); // 不能重复,重复则以最后一个设置的为准

    return registrationBean;
}
 
Example 11
Source File: EurekaRibbonConfig.java    From fw-spring-cloud with Apache License 2.0 5 votes vote down vote up
/**
 * 解决dashboard显示 Unable to connect to Command Metric Stream
 */
@Bean
public ServletRegistrationBean getServlet() {
    HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();
    ServletRegistrationBean registrationBean = new ServletRegistrationBean(streamServlet);
    registrationBean.setLoadOnStartup(1);
    registrationBean.addUrlMappings("/hystrix.stream");
    registrationBean.setName("HystrixMetricsStreamServlet");
    return registrationBean;
}
 
Example 12
Source File: KittyConsumerApplication.java    From kitty with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Bean
public ServletRegistrationBean getServlet() {
	HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();
	ServletRegistrationBean registrationBean = new ServletRegistrationBean(streamServlet);
	registrationBean.setLoadOnStartup(1);
	registrationBean.addUrlMappings("/hystrix.stream");
	registrationBean.setName("HystrixMetricsStreamServlet");
	return registrationBean;
}
 
Example 13
Source File: HystrixDashboardConfiger.java    From HIS with Apache License 2.0 5 votes vote down vote up
/**
 *
 * 地址/hystrix
 */
@Bean
public ServletRegistrationBean getServlet() {
    HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();
    ServletRegistrationBean registrationBean = new ServletRegistrationBean(streamServlet);  //Spring boot 以代码的方式装载servlet
    registrationBean.setLoadOnStartup(1); //设置启动顺序
    registrationBean.addUrlMappings("/hystrix.stream");
    registrationBean.setName("HystrixMetricsStreamServlet");
    return registrationBean;
}
 
Example 14
Source File: OrderApplication.java    From code with Apache License 2.0 5 votes vote down vote up
@Bean
public ServletRegistrationBean getServlet(){
    HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();
    ServletRegistrationBean registrationBean = new ServletRegistrationBean(streamServlet);
    registrationBean.setLoadOnStartup(1);
    registrationBean.addUrlMappings("/hystrix.stream");/*/actuator/hystrix.stream*/
    registrationBean.setName("HystrixMetricsStreamServlet");
    return registrationBean;
}
 
Example 15
Source File: HystrixDashboardConfiger.java    From HIS with Apache License 2.0 5 votes vote down vote up
/**
 *
 * 地址/hystrix
 */
@Bean
public ServletRegistrationBean getServlet() {
    HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();
    ServletRegistrationBean registrationBean = new ServletRegistrationBean(streamServlet);  //Spring boot 以代码的方式装载servlet
    registrationBean.setLoadOnStartup(1); //设置启动顺序
    registrationBean.addUrlMappings("/hystrix.stream");
    registrationBean.setName("HystrixMetricsStreamServlet");
    return registrationBean;
}
 
Example 16
Source File: GovernanceApplication.java    From WeEvent with Apache License 2.0 5 votes vote down vote up
@Bean
public ServletRegistrationBean<DispatcherServlet> weeventGovernanceServletBean(WebApplicationContext wac) {
    DispatcherServlet ds = new DispatcherServlet(wac);
    ServletRegistrationBean<DispatcherServlet> bean = new ServletRegistrationBean<>(ds, "/weevent-governance/*");
    bean.setName("weeventGovernance");
    return bean;
}
 
Example 17
Source File: HystrixConfiguration.java    From springcloud-course with GNU General Public License v3.0 5 votes vote down vote up
@Bean(name = "hystrixRegistrationBean")
public ServletRegistrationBean servletRegistrationBean() {
    ServletRegistrationBean registration = new ServletRegistrationBean(
            new HystrixMetricsStreamServlet(), "/hystrix.stream");
    registration.setName("hystrixServlet");
    registration.setLoadOnStartup(1);
    return registration;
}
 
Example 18
Source File: HystrixConfiguration.java    From springcloud-course with GNU General Public License v3.0 5 votes vote down vote up
@Bean(name = "hystrixForTurbineRegistrationBean")
public ServletRegistrationBean servletTurbineRegistrationBean() {
    ServletRegistrationBean registration = new ServletRegistrationBean(
            new HystrixMetricsStreamServlet(), "/actuator/hystrix.stream");
    registration.setName("hystrixForTurbineServlet");
    registration.setLoadOnStartup(1);
    return registration;
}
 
Example 19
Source File: HystrixConfiguration.java    From springcloud-course with GNU General Public License v3.0 5 votes vote down vote up
@Bean(name = "hystrixForTurbineRegistrationBean")
public ServletRegistrationBean servletTurbineRegistrationBean() {
    ServletRegistrationBean registration = new ServletRegistrationBean(
            new HystrixMetricsStreamServlet(), "/actuator/hystrix.stream");
    registration.setName("hystrixForTurbineServlet");
    registration.setLoadOnStartup(1);
    return registration;
}
 
Example 20
Source File: Application.java    From tutorials with MIT License 4 votes vote down vote up
@Bean
ServletRegistrationBean servletRegistrationBean() {
    ServletRegistrationBean servlet = new ServletRegistrationBean(new CamelHttpTransportServlet(), contextPath+"/*");
    servlet.setName("CamelServlet");
    return servlet;
}