@Override public RegistrationBean createRegistrationBean(String name, Servlet source, int totalNumberOfSourceBeans) { String url = (totalNumberOfSourceBeans != 1) ? "/" + name + "/" : "/"; if (name.equals(DISPATCHER_SERVLET_NAME)) { url = "/"; // always map the main dispatcherServlet to "/" } ServletRegistrationBean<Servlet> bean = new ServletRegistrationBean<>(source, url); bean.setName(name); bean.setMultipartConfig(this.multipartConfig); return bean; }
@Bean public HttpRequestHandler image() { return new ImageServlet(); } @Bean public ServletRegistrationBean imageServletRegistrationBean() { ServletRegistrationBean imageServlet = new ServletRegistrationBean( new HttpRequestHandlerServlet(), "/image/*"); imageServlet.setName("image"); return imageServlet; }
@Bean public ServletRegistrationBean<MyServlet> servletRegistrationBean() { ServletRegistrationBean<MyServlet> registration = new ServletRegistrationBean<>( new MyServlet(), "/myServlet/*"); registration.setName(MY_SERVLET); return registration; }
@Bean public DispatcherServlet dispatcherServlet() { return new DispatcherServlet(); } @Bean public ServletRegistrationBean dispatcherServletRegistration() { ServletRegistrationBean registration = new ServletRegistrationBean( dispatcherServlet(), "*.html"); registration .setName(DispatcherServletAutoConfiguration.DEFAULT_DISPATCHER_SERVLET_REGISTRATION_BEAN_NAME); return registration; }
@Bean public ServletRegistrationBean getServlet() { HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet(); ServletRegistrationBean<HystrixMetricsStreamServlet> registrationBean = new ServletRegistrationBean<>(streamServlet); registrationBean.setLoadOnStartup(1); registrationBean.addUrlMappings("/hystrix.stream"); registrationBean.setName("HystrixMetricsStreamServlet"); return registrationBean; } }
@Bean public ServletRegistrationBean obfuscatedDispatcherServlet() { final DispatcherServlet dispatcherServlet = new DispatcherServlet(); final ApplicationContext applicationContext = new AnnotationConfigWebApplicationContext(); dispatcherServlet.setApplicationContext(applicationContext); final ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(dispatcherServlet, "/" + this.pathPrefix + "/*"); servletRegistrationBean.setName("joal"); return servletRegistrationBean; }
@Bean ServletRegistrationBean camelServlet() { // use a @Bean to register the Camel servlet which we need to do // because we want to use the camel-servlet component for the Camel REST service ServletRegistrationBean mapping = new ServletRegistrationBean(); mapping.setName("CamelServlet"); mapping.setLoadOnStartup(1); mapping.setServlet(new CamelHttpTransportServlet()); mapping.addUrlMappings("/camel/*"); return mapping; }
@Bean public DispatcherServlet dispatcherServlet() { DispatcherServlet servlet=new DispatcherServlet(); servlet.getServletContext().addListener(new ExecutorListener()); return servlet; } @Bean public ServletRegistrationBean dispatcherServletRegistration() { ServletRegistrationBean registrationBean = new ServletRegistrationBean(dispatcherServlet(), "/rest/v1/*"); registrationBean .setName(DispatcherServletAutoConfiguration.DEFAULT_DISPATCHER_SERVLET_REGISTRATION_BEAN_NAME); return registrationBean; }
@Bean public ServletRegistrationBean servletRegistrationBean() { ServletRegistrationBean mapping = new ServletRegistrationBean(); mapping.setServlet(new CamelHttpTransportServlet()); mapping.addUrlMappings("/webhook/*"); mapping.setName("CamelServlet"); mapping.setLoadOnStartup(1); return mapping; }
@Bean ServletRegistrationBean camelServlet() { // TODO: Camel 2.19 should support this OOTB // use a @Bean to register the Camel servlet which we need to do // because we want to use the camel-servlet component for the Camel REST service ServletRegistrationBean mapping = new ServletRegistrationBean(); mapping.setName("CamelServlet"); mapping.setLoadOnStartup(1); // CamelHttpTransportServlet is the name of the Camel servlet to use mapping.setServlet(new CamelHttpTransportServlet()); mapping.addUrlMappings("/api/*"); return mapping; }
@Bean ServletRegistrationBean camelServlet() { // TODO: Camel 2.19 should support this OOTB // use a @Bean to register the Camel servlet which we need to do // because we want to use the camel-servlet component for the Camel REST service ServletRegistrationBean mapping = new ServletRegistrationBean(); mapping.setName("CamelServlet"); mapping.setLoadOnStartup(1); // CamelHttpTransportServlet is the name of the Camel servlet to use mapping.setServlet(new CamelHttpTransportServlet()); mapping.addUrlMappings("/api/*"); return mapping; }
@Bean ServletRegistrationBean servletRegistrationBean(HystrixMappingConfiguration config) { ServletRegistrationBean mapping = new ServletRegistrationBean(); mapping.setServlet(new HystrixEventStreamServlet()); mapping.addUrlMappings(config.getPath()); mapping.setName(config.getServletName()); return mapping; }
@Bean ServletRegistrationBean camelServlet() { // use a @Bean to register the Camel servlet which we need to do // because we want to use the camel-servlet component for the Camel REST service ServletRegistrationBean mapping = new ServletRegistrationBean(); mapping.setName("CamelServlet"); mapping.setLoadOnStartup(1); // CamelHttpTransportServlet is the name of the Camel servlet to use mapping.setServlet(new CamelHttpTransportServlet()); mapping.addUrlMappings("/camel/*"); return mapping; }
@Bean public ServletRegistrationBean dispatcherServletRegistration() { DispatcherServlet dispatcherServlet = dispatcherServlet(); ServletRegistrationBean registration = new ServletRegistrationBean(); registration.setName(DispatcherServletAutoConfiguration.DEFAULT_DISPATCHER_SERVLET_BEAN_NAME); registration.setServlet(dispatcherServlet); // registration.addInitParameter("contextConfigLocation", "classpath:spring-mvc.xml"); registration.addInitParameter("contextConfigLocation", MvcAdvanceConfig.class.getName()); registration.setLoadOnStartup(1); registration.setAsyncSupported(true); registration.addUrlMappings("/", "*.do"); return registration; }
@Bean ServletRegistrationBean servletRegistrationBean(ServletMappingConfiguration config) { ServletRegistrationBean mapping = new ServletRegistrationBean(); mapping.setServlet(new CamelHttpTransportServlet()); mapping.addUrlMappings(config.getContextPath()); mapping.setName(config.getServletName()); mapping.setLoadOnStartup(1); return mapping; }
@Bean public ServletRegistrationBean publicJersey() { ServletRegistrationBean publicJersey = new ServletRegistrationBean(new ServletContainer(new RestPublicConfiguration())); publicJersey.addUrlMappings("/" + RestPaths.PUBLIC_REST + "/*"); publicJersey.setName("RestPublic"); publicJersey.setLoadOnStartup(0); return publicJersey; }
@Bean public ServletRegistrationBean springBatchSupportServlet() { AnnotationConfigWebApplicationContext applicationContext = new AnnotationConfigWebApplicationContext(); applicationContext.register(SpringBatchSupportWebServletConfig.class); DispatcherServlet dispatcherServlet = new DispatcherServlet(); dispatcherServlet.setApplicationContext(applicationContext); ServletRegistrationBean registrationBean = new ServletRegistrationBean(dispatcherServlet, getServletMapping()); registrationBean.setName(getServletName()); registrationBean.setLoadOnStartup(1); return registrationBean; }
@Bean public ServletRegistrationBean springLoggingSupportWebServlet() { AnnotationConfigWebApplicationContext applicationContext = new AnnotationConfigWebApplicationContext(); applicationContext.register(LoggingConfig.class); DispatcherServlet dispatcherServlet = new DispatcherServlet(); dispatcherServlet.setApplicationContext(applicationContext); ServletRegistrationBean registrationBean = new ServletRegistrationBean(dispatcherServlet, getServletMapping()); registrationBean.setName(getServletName()); registrationBean.setLoadOnStartup(1); return registrationBean; }
@Bean public ServletRegistrationBean privateJersey() { ServletRegistrationBean privateJersey = new ServletRegistrationBean(new ServletContainer(new RestPrivateConfiguration())); privateJersey.addUrlMappings("/" + RestPaths.REST + "/*"); privateJersey.setName("RestPrivate"); privateJersey.setLoadOnStartup(0); return privateJersey; }
@Bean public ServletRegistrationBean configurationServlet() { AnnotationConfigWebApplicationContext applicationContext = new AnnotationConfigWebApplicationContext(); applicationContext.register(ConfigServletConfig.class); DispatcherServlet dispatcherServlet = new DispatcherServlet(); dispatcherServlet.setApplicationContext(applicationContext); ServletRegistrationBean registrationBean = new ServletRegistrationBean(dispatcherServlet, namicsConfigurationProperties.getWeb() .getServletMapping()); registrationBean.setName(namicsConfigurationProperties.getWeb().getServletName()); registrationBean.setLoadOnStartup(1); return registrationBean; }