Java Code Examples for org.springframework.boot.web.servlet.ServletRegistrationBean#setAsyncSupported()
The following examples show how to use
org.springframework.boot.web.servlet.ServletRegistrationBean#setAsyncSupported() .
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: EmbeddedServerConfig.java From secrets-proxy with Apache License 2.0 | 6 votes |
/** * Configures a custom jetty http proxy servlet based on <b>oneops.proxy.enabled</b> config * property. The proxy configuration is done on the <b>application.yaml</b> file. * * @param config OneOps config * @return {@link ServletRegistrationBean} */ @Bean @ConditionalOnProperty("oneops.proxy.enabled") public ServletRegistrationBean registerProxyServlet(OneOpsConfig config) { log.info("OneOps Http Proxy is enabled."); OneOpsConfig.Proxy proxyCfg = config.getProxy(); Map<String, String> initParams = new HashMap<>(); initParams.put(proxyTo.name(), proxyCfg.getProxyTo()); initParams.put(prefix.name(), proxyCfg.getPrefix()); initParams.put(viaHost.name(), proxyCfg.getViaHost()); initParams.put(trustAll.name(), String.valueOf(proxyCfg.isTrustAll())); initParams.put(xAuthHeader.name(), config.getAuth().getHeader()); ServletRegistrationBean servletBean = new ServletRegistrationBean(new ProxyServlet(), proxyCfg.getPrefix() + "/*"); servletBean.setName("OneOps Proxy Servlet"); servletBean.setInitParameters(initParams); servletBean.setAsyncSupported(true); log.info("Configured OneOps proxy servlet with mapping: " + proxyCfg.getPrefix()); return servletBean; }
Example 2
Source File: EmbeddedKeycloakConfig.java From spring-security-oauth with MIT License | 6 votes |
@Bean ServletRegistrationBean<HttpServlet30Dispatcher> keycloakJaxRsApplication( KeycloakServerProperties keycloakServerProperties, DataSource dataSource) throws Exception { mockJndiEnvironment(dataSource); EmbeddedKeycloakApplication.keycloakServerProperties = keycloakServerProperties; ServletRegistrationBean<HttpServlet30Dispatcher> servlet = new ServletRegistrationBean<>( new HttpServlet30Dispatcher()); servlet.addInitParameter("javax.ws.rs.Application", EmbeddedKeycloakApplication.class.getName()); servlet.addInitParameter(ResteasyContextParameters.RESTEASY_SERVLET_MAPPING_PREFIX, keycloakServerProperties.getContextPath()); servlet.addInitParameter(ResteasyContextParameters.RESTEASY_USE_CONTAINER_FORM_PARAMS, "true"); servlet.addUrlMappings(keycloakServerProperties.getContextPath() + "/*"); servlet.setLoadOnStartup(1); servlet.setAsyncSupported(true); return servlet; }
Example 3
Source File: EmbeddedKeycloakConfig.java From spring-security-oauth with MIT License | 6 votes |
@Bean ServletRegistrationBean<HttpServlet30Dispatcher> keycloakJaxRsApplication(KeycloakServerProperties keycloakServerProperties, DataSource dataSource) throws Exception { mockJndiEnvironment(dataSource); EmbeddedKeycloakApplication.keycloakServerProperties = keycloakServerProperties; ServletRegistrationBean<HttpServlet30Dispatcher> servlet = new ServletRegistrationBean<>(new HttpServlet30Dispatcher()); servlet.addInitParameter("javax.ws.rs.Application", EmbeddedKeycloakApplication.class.getName()); servlet.addInitParameter(ResteasyContextParameters.RESTEASY_SERVLET_MAPPING_PREFIX, keycloakServerProperties.getContextPath()); servlet.addInitParameter(ResteasyContextParameters.RESTEASY_USE_CONTAINER_FORM_PARAMS, "true"); servlet.addUrlMappings(keycloakServerProperties.getContextPath() + "/*"); servlet.setLoadOnStartup(1); servlet.setAsyncSupported(true); return servlet; }
Example 4
Source File: HttpServerConfig.java From Spring-5.0-Cookbook with MIT License | 5 votes |
public ServletRegistrationBean routeServlet1(RouterFunction<?> routerFunction) throws Exception { HttpHandler httpHandler = RouterFunctions.toHttpHandler(routerFunction ); ServletHttpHandlerAdapter servlet = new ServletHttpHandlerAdapter(httpHandler); ServletRegistrationBean registrationBean = new ServletRegistrationBean<>(servlet, "/flux" + "/*"); registrationBean.setLoadOnStartup(1); registrationBean.setAsyncSupported(true); System.out.println("starts server"); return registrationBean; }
Example 5
Source File: ApplicationConfiguration.java From flowable-engine with Apache License 2.0 | 5 votes |
@Bean public ServletRegistrationBean apiServlet(ApplicationContext applicationContext) { AnnotationConfigWebApplicationContext dispatcherServletConfiguration = new AnnotationConfigWebApplicationContext(); dispatcherServletConfiguration.setParent(applicationContext); dispatcherServletConfiguration.register(ApiDispatcherServletConfiguration.class); DispatcherServlet servlet = new DispatcherServlet(dispatcherServletConfiguration); ServletRegistrationBean registrationBean = new ServletRegistrationBean(servlet, "/api/*"); registrationBean.setName("Flowable IDM App API Servlet"); registrationBean.setLoadOnStartup(1); registrationBean.setAsyncSupported(true); return registrationBean; }
Example 6
Source File: DruidWebStatAutoConfiguration.java From spring-boot-starter-dao with Apache License 2.0 | 5 votes |
@Bean ServletRegistrationBean servletRegistration(DruidStatProperties druidStatConfig) { ServletRegistrationBean filterRegistration = new ServletRegistrationBean(new StatViewServlet()); filterRegistration.setAsyncSupported(true); filterRegistration.setEnabled(true); filterRegistration.addUrlMappings("/druid/*"); filterRegistration.setInitParameters(druidStatParameters(druidStatConfig)); return filterRegistration; }
Example 7
Source File: ParaServer.java From para with Apache License 2.0 | 5 votes |
/** * @return API servlet bean */ @Bean public ServletRegistrationBean<?> apiV1RegistrationBean() { String path = Api1.PATH + "*"; ServletRegistrationBean<?> reg = new ServletRegistrationBean<>(new ServletContainer(new Api1()), path); logger.debug("Initializing Para API v1 [{}]...", path); reg.setName(Api1.class.getSimpleName()); reg.setAsyncSupported(true); reg.setEnabled(true); reg.setOrder(3); return reg; }
Example 8
Source File: FunctionalSpringBootApplication.java From tutorials with MIT License | 5 votes |
@Bean public ServletRegistrationBean servletRegistrationBean() throws Exception { HttpHandler httpHandler = WebHttpHandlerBuilder.webHandler((WebHandler) toHttpHandler(routingFunction())) .filter(new IndexRewriteFilter()) .build(); ServletRegistrationBean registrationBean = new ServletRegistrationBean<>(new RootServlet(httpHandler), "/"); registrationBean.setLoadOnStartup(1); registrationBean.setAsyncSupported(true); return registrationBean; }
Example 9
Source File: HttpServerConfig.java From Spring-5.0-Cookbook with MIT License | 5 votes |
public ServletRegistrationBean routeServlet1(RouterFunction<?> routerFunction) throws Exception { HttpHandler httpHandler = RouterFunctions.toHttpHandler(routerFunction ); ServletHttpHandlerAdapter servlet = new ServletHttpHandlerAdapter(httpHandler); ServletRegistrationBean registrationBean = new ServletRegistrationBean<>(servlet, "/flux" + "/*"); registrationBean.setLoadOnStartup(1); registrationBean.setAsyncSupported(true); System.out.println("starts server"); return registrationBean; }
Example 10
Source File: HttpServerConfig.java From Spring-5.0-Cookbook with MIT License | 5 votes |
public ServletRegistrationBean routeServlet1(RouterFunction<?> routerFunction) throws Exception { HttpHandler httpHandler = RouterFunctions.toHttpHandler(routerFunction ); ServletHttpHandlerAdapter servlet = new ServletHttpHandlerAdapter(httpHandler); ServletRegistrationBean registrationBean = new ServletRegistrationBean<>(servlet, "/flux" + "/*"); registrationBean.setLoadOnStartup(1); registrationBean.setAsyncSupported(true); System.out.println("starts server"); return registrationBean; }
Example 11
Source File: HttpServerConfig.java From Spring-5.0-Cookbook with MIT License | 5 votes |
public ServletRegistrationBean routeServlet1(RouterFunction<?> routerFunction) throws Exception { HttpHandler httpHandler = RouterFunctions.toHttpHandler(routerFunction ); ServletHttpHandlerAdapter servlet = new ServletHttpHandlerAdapter(httpHandler); ServletRegistrationBean registrationBean = new ServletRegistrationBean<>(servlet, "/flux" + "/*"); registrationBean.setLoadOnStartup(1); registrationBean.setAsyncSupported(true); System.out.println("starts server"); return registrationBean; }
Example 12
Source File: HttpServerConfig.java From Spring-5.0-Cookbook with MIT License | 5 votes |
public ServletRegistrationBean routeServlet1(RouterFunction<?> routerFunction) throws Exception { HttpHandler httpHandler = RouterFunctions.toHttpHandler(routerFunction ); ServletHttpHandlerAdapter servlet = new ServletHttpHandlerAdapter(httpHandler); ServletRegistrationBean registrationBean = new ServletRegistrationBean<>(servlet, "/flux" + "/*"); registrationBean.setLoadOnStartup(1); registrationBean.setAsyncSupported(true); System.out.println("starts server"); return registrationBean; }
Example 13
Source File: WebServerConfig.java From NettyReverseProxy with Apache License 2.0 | 5 votes |
/** * 修改默认dispatcherServlet配置 */ @Bean public ServletRegistrationBean servletRegistrationBean(DispatcherServlet dispatcherServlet) { ServletRegistrationBean registration = new ServletRegistrationBean<>(dispatcherServlet); registration.getUrlMappings().clear(); registration.addUrlMappings("/"); registration.setAsyncSupported(true); return registration; }
Example 14
Source File: ExternalJobRestTestApplication.java From flowable-engine with Apache License 2.0 | 5 votes |
@Bean public ServletRegistrationBean<DispatcherServlet> actionEngineTestDispatcherServlet(ApplicationContext applicationContext) { AnnotationConfigWebApplicationContext dispatcherServletConfiguration = new AnnotationConfigWebApplicationContext(); dispatcherServletConfiguration.setParent(applicationContext); dispatcherServletConfiguration.register(DispatcherServletConfiguration.class); DispatcherServlet servlet = new DispatcherServlet(dispatcherServletConfiguration); ServletRegistrationBean<DispatcherServlet> registrationBean = new ServletRegistrationBean<>(servlet, "/service/*"); registrationBean.setName("External Job Test Servlet"); registrationBean.setMultipartConfig(new MultipartConfigElement((String) null)); registrationBean.setLoadOnStartup(1); registrationBean.setAsyncSupported(true); return registrationBean; }
Example 15
Source File: HttpServerConfig.java From Spring-5.0-Cookbook with MIT License | 5 votes |
public ServletRegistrationBean routeServlet1(RouterFunction<?> routerFunction) throws Exception { HttpHandler httpHandler = RouterFunctions.toHttpHandler(routerFunction ); ServletHttpHandlerAdapter servlet = new ServletHttpHandlerAdapter(httpHandler); ServletRegistrationBean registrationBean = new ServletRegistrationBean<>(servlet, "/flux" + "/*"); registrationBean.setLoadOnStartup(1); registrationBean.setAsyncSupported(true); System.out.println("starts server"); return registrationBean; }
Example 16
Source File: HttpServerConfig.java From Spring-5.0-Cookbook with MIT License | 5 votes |
public ServletRegistrationBean routeServlet1(RouterFunction<?> routerFunction) throws Exception { HttpHandler httpHandler = RouterFunctions.toHttpHandler(routerFunction ); ServletHttpHandlerAdapter servlet = new ServletHttpHandlerAdapter(httpHandler); ServletRegistrationBean registrationBean = new ServletRegistrationBean<>(servlet, "/flux" + "/*"); registrationBean.setLoadOnStartup(1); registrationBean.setAsyncSupported(true); System.out.println("starts server"); return registrationBean; }
Example 17
Source File: HttpServerConfig.java From Spring-5.0-Cookbook with MIT License | 5 votes |
public ServletRegistrationBean routeServlet1(RouterFunction<?> routerFunction) throws Exception { HttpHandler httpHandler = RouterFunctions.toHttpHandler(routerFunction ); ServletHttpHandlerAdapter servlet = new ServletHttpHandlerAdapter(httpHandler); ServletRegistrationBean registrationBean = new ServletRegistrationBean<>(servlet, "/flux" + "/*"); registrationBean.setLoadOnStartup(1); registrationBean.setAsyncSupported(true); System.out.println("starts server"); return registrationBean; }
Example 18
Source File: ZkMaxAutoConfiguration.java From zkspringboot with Apache License 2.0 | 5 votes |
@Bean @ConditionalOnProperty(prefix = "zk", name = "servlet3-push-enabled", matchIfMissing = true) public ServletRegistrationBean cometAsyncServlet() { final String cometUri = "/zkcomet"; ServletRegistrationBean reg = new ServletRegistrationBean(new CometAsyncServlet(), cometUri + "/*"); reg.setAsyncSupported(true); logger.info("ZK-Springboot: ServletRegistrationBean for CometAsyncServlet with path " + cometUri); return reg; }
Example 19
Source File: ActivitiUIApplication.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@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 20
Source File: ActivitiUIApplication.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@Bean public ServletRegistrationBean apiDispatcher() { DispatcherServlet api = new DispatcherServlet(); api.setContextClass(AnnotationConfigWebApplicationContext.class); api.setContextConfigLocation(ApiDispatcherServletConfiguration.class.getName()); ServletRegistrationBean registrationBean = new ServletRegistrationBean(); registrationBean.setServlet(api); registrationBean.addUrlMappings("/api/*"); // api下面的所有内容都访问到这里 registrationBean.setLoadOnStartup(1); registrationBean.setAsyncSupported(true); registrationBean.setName("api"); // 不能重复,重复则以最后一个设置的为准 return registrationBean; }