org.springframework.boot.context.embedded.EmbeddedServletContainerFactory Java Examples
The following examples show how to use
org.springframework.boot.context.embedded.EmbeddedServletContainerFactory.
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: WebServerConfiguration.java From youkefu with Apache License 2.0 | 6 votes |
@Bean public EmbeddedServletContainerFactory createEmbeddedServletContainerFactory() throws IOException, NoSuchAlgorithmException { TomcatEmbeddedServletContainerFactory tomcatFactory = new TomcatEmbeddedServletContainerFactory(); tomcatFactory.addConnectorCustomizers(new UKeFuTomcatConnectorCustomizer(maxthread, maxconnections)); File sslFile = new File(path , "ssl/https.properties") ; if(sslFile.exists()){ Properties sslProperties = new Properties(); FileInputStream in = new FileInputStream(sslFile); sslProperties.load(in); in.close(); if(!StringUtils.isBlank(sslProperties.getProperty("key-store")) && !StringUtils.isBlank(sslProperties.getProperty("key-store-password"))){ Ssl ssl = new Ssl(); ssl.setKeyStore(new File(path , "ssl/"+sslProperties.getProperty("key-store")).getAbsolutePath()); ssl.setKeyStorePassword(UKTools.decryption(sslProperties.getProperty("key-store-password"))); tomcatFactory.setSsl(ssl); } } return tomcatFactory; }
Example #2
Source File: WebConfig.java From jcart with MIT License | 6 votes |
@Bean public EmbeddedServletContainerFactory servletContainer() { TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory() { @Override protected void postProcessContext(Context context) { SecurityConstraint securityConstraint = new SecurityConstraint(); securityConstraint.setUserConstraint("CONFIDENTIAL"); SecurityCollection collection = new SecurityCollection(); collection.addPattern("/*"); securityConstraint.addCollection(collection); context.addConstraint(securityConstraint); } }; tomcat.addAdditionalTomcatConnectors(initiateHttpConnector()); return tomcat; }
Example #3
Source File: WebConfig.java From jcart with MIT License | 6 votes |
@Bean public EmbeddedServletContainerFactory servletContainer() { TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory() { @Override protected void postProcessContext(Context context) { SecurityConstraint securityConstraint = new SecurityConstraint(); securityConstraint.setUserConstraint("CONFIDENTIAL"); SecurityCollection collection = new SecurityCollection(); collection.addPattern("/*"); securityConstraint.addCollection(collection); context.addConstraint(securityConstraint); } }; tomcat.addAdditionalTomcatConnectors(initiateHttpConnector()); return tomcat; }
Example #4
Source File: SSLConfig.java From NoteBlog with MIT License | 6 votes |
@Bean public EmbeddedServletContainerFactory servletContainer() { TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory() { @Override protected void postProcessContext(Context context) { if (environment.getProperty("server.ssl.enabled", Boolean.class, Boolean.FALSE)) { SecurityConstraint constraint = new SecurityConstraint(); constraint.setUserConstraint("CONFIDENTIAL"); SecurityCollection collection = new SecurityCollection(); collection.addPattern("/*"); constraint.addCollection(collection); context.addConstraint(constraint); } else { super.postProcessContext(context); } } }; if (environment.getProperty("server.ssl.enabled", Boolean.class, Boolean.FALSE)) { tomcat.addAdditionalTomcatConnectors(httpConnector()); } return tomcat; }
Example #5
Source File: SystemConfiguration.java From NFVO with Apache License 2.0 | 6 votes |
@Bean public EmbeddedServletContainerFactory servletContainer() { if (https) { TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory() { @Override protected void postProcessContext(Context context) { SecurityConstraint securityConstraint = new SecurityConstraint(); securityConstraint.setUserConstraint("CONFIDENTIAL"); SecurityCollection collection = new SecurityCollection(); collection.addPattern("/*"); securityConstraint.addCollection(collection); context.addConstraint(securityConstraint); } }; tomcat.addAdditionalTomcatConnectors(initiateHttpConnector()); return tomcat; } return new TomcatEmbeddedServletContainerFactory(); }
Example #6
Source File: TomcatConfig.java From find with MIT License | 6 votes |
@Bean public EmbeddedServletContainerFactory servletContainer() { final TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory(); if(useReverseProxy) { tomcat.addAdditionalTomcatConnectors(createAjpConnector()); } // Set the web resources cache size (this defaults to 10MB but that is too small for Find) tomcat.addContextCustomizers(context -> { final WebResourceRoot resources = new StandardRoot(context); resources.setCacheMaxSize(webResourcesCacheSize); context.setResources(resources); }); tomcat.addConnectorCustomizers(connector -> { connector.setMaxPostSize(connectorMaxPostSize); }); return tomcat; }
Example #7
Source File: SslConfig.java From spring-boot-cookbook with Apache License 2.0 | 6 votes |
@Bean public EmbeddedServletContainerFactory servletContainer() { TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory() { @Override protected void postProcessContext(Context context) { // SecurityConstraint必须存在,可以通过其为不同的URL设置不同的重定向策略。 SecurityConstraint constraint = new SecurityConstraint(); constraint.setUserConstraint("CONFIDENTIAL"); SecurityCollection collection = new SecurityCollection(); collection.addPattern("/*"); constraint.addCollection(collection); context.addConstraint(constraint); } }; tomcat.addAdditionalTomcatConnectors(httpConnector()); return tomcat; }
Example #8
Source File: ServletContainerConfiguration.java From haven-platform with Apache License 2.0 | 5 votes |
/** * adds SSL connector to Tomcat * * @return */ @Bean public EmbeddedServletContainerFactory servletContainer() { TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory(); if (StringUtils.hasText(keystoreFile)) { tomcat.addAdditionalTomcatConnectors(createSslConnector()); } return tomcat; }
Example #9
Source File: TomcatConfig.java From tailstreamer with MIT License | 5 votes |
@Bean public EmbeddedServletContainerFactory servletContainer() { TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory(); if (sslConfig != null && sslConfig.isEnable()) { tomcat.addAdditionalTomcatConnectors(createSslConnector()); } return tomcat; }
Example #10
Source File: NettyServerApplication.java From Thunder with Apache License 2.0 | 5 votes |
@Bean public EmbeddedServletContainerFactory createEmbeddedServletContainerFactory() { TomcatEmbeddedServletContainerFactory tomcatFactory = new TomcatEmbeddedServletContainerFactory(); tomcatFactory.setPort(8081); return tomcatFactory; }
Example #11
Source File: TestContext.java From Cerberus with MIT License | 5 votes |
@Bean public EmbeddedServletContainerFactory servletContainer() { TomcatEmbeddedServletContainerFactory factory = new TomcatEmbeddedServletContainerFactory(); factory.setPort(TestApiConfig.PORT); factory.setSessionTimeout(10, TimeUnit.MINUTES); return factory; }
Example #12
Source File: MonetaSpringBootApplication.java From moneta with Apache License 2.0 | 5 votes |
@Bean public EmbeddedServletContainerFactory servletContainer() { JettyEmbeddedServletContainerFactory factory = new JettyEmbeddedServletContainerFactory(); factory.addServerCustomizers(new JettyServerCustomizer() { public void customize(final Server server) { // Tweak the connection pool used by Jetty to handle incoming // HTTP connections Integer localServerMaxThreads = deriveValue(serverMaxThreads, DEFAULT_SERVER_MAX_THREADS); Integer localServerMinThreads = deriveValue(serverMinThreads, DEFAULT_SERVER_MIN_THREADS); Integer localServerIdleTimeout = deriveValue(serverIdleTimeout, DEFAULT_SERVER_IDLE_TIMEOUT); logger.info("Container Max Threads={}", localServerMaxThreads); logger.info("Container Min Threads={}", localServerMinThreads); logger.info("Container Idle Timeout={}", localServerIdleTimeout); final QueuedThreadPool threadPool = server.getBean(QueuedThreadPool.class); threadPool.setMaxThreads(Integer.valueOf(localServerMaxThreads)); threadPool.setMinThreads(Integer.valueOf(localServerMinThreads)); threadPool.setIdleTimeout(Integer.valueOf(localServerIdleTimeout)); } }); return factory; }
Example #13
Source File: TomcatConfig.java From WeBASE-Front with Apache License 2.0 | 5 votes |
@Bean public EmbeddedServletContainerFactory createEmbeddedServletContainerFactory() { TomcatEmbeddedServletContainerFactory tomcatFactory = new TomcatEmbeddedServletContainerFactory(); tomcatFactory.addConnectorCustomizers(connector -> { Http11NioProtocol protocol = (Http11NioProtocol) connector.getProtocolHandler(); protocol.setKeepAliveTimeout(constantProperties.getKeepAliveTimeout()* 1000); protocol.setMaxKeepAliveRequests(constantProperties.getKeepAliveRequests()); }); return tomcatFactory; }
Example #14
Source File: HttpsConfiguration.java From spring-boot with Apache License 2.0 | 5 votes |
@Bean public EmbeddedServletContainerFactory servletContainer() { TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory(); tomcat.setUriEncoding(Charset.forName("UTF-8")); tomcat.addAdditionalTomcatConnectors(createSslConnector()); log.info("\n*** Tomcat SSL setting successful." + properties.getPort()); return tomcat; }
Example #15
Source File: WebServerConfiguration.java From goods-seckill with Apache License 2.0 | 5 votes |
@Bean public EmbeddedServletContainerFactory createEmbeddedServletContainerFactory() { TomcatEmbeddedServletContainerFactory tomcatFactory = new TomcatEmbeddedServletContainerFactory(); tomcatFactory.setPort(8080); tomcatFactory.addConnectorCustomizers(new MyTomcatConnectorCustomizer()); return tomcatFactory; }
Example #16
Source File: Application.java From Spring with Apache License 2.0 | 5 votes |
@Bean public EmbeddedServletContainerFactory servletContainer() { final TomcatEmbeddedServletContainerFactory factory = new TomcatEmbeddedServletContainerFactory(); factory.setPort(appSettings.getPort()); factory.setSessionTimeout(appSettings.getSessionTimeout(), TimeUnit.MINUTES); factory.setContextPath(appSettings.getContext()); return factory; }
Example #17
Source File: Application.java From binance-marketmaker with The Unlicense | 5 votes |
@Bean public EmbeddedServletContainerFactory servletContainer() { TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory(); Connector ajpConnector = new Connector("AJP/1.3"); ajpConnector.setPort(9090); ajpConnector.setSecure(false); ajpConnector.setAllowTrace(false); ajpConnector.setScheme("http"); tomcat.addAdditionalTomcatConnectors(ajpConnector); return tomcat; }
Example #18
Source File: TomcatConfig.java From WeBASE-Sign with Apache License 2.0 | 5 votes |
@Bean public EmbeddedServletContainerFactory createEmbeddedServletContainerFactory() { TomcatEmbeddedServletContainerFactory tomcatFactory = new TomcatEmbeddedServletContainerFactory(); tomcatFactory.addConnectorCustomizers(connector -> { Http11NioProtocol protocol = (Http11NioProtocol) connector.getProtocolHandler(); protocol.setKeepAliveTimeout(10 * 1000); protocol.setMaxKeepAliveRequests(constantProperties.getKeepAliveRequests()); }); return tomcatFactory; }
Example #19
Source File: Application.java From spring-cxf with Apache License 2.0 | 4 votes |
@Bean public EmbeddedServletContainerFactory embeddedServletContainerFactory() { // Made to match the context path when deploying to standalone tomcat- can easily be kept in sync w/ properties TomcatEmbeddedServletContainerFactory factory = new TomcatEmbeddedServletContainerFactory("/ws-server-1.0", 8080); return factory; }
Example #20
Source File: IoTPMessageConfiguration.java From iotplatform with Apache License 2.0 | 4 votes |
@Bean public EmbeddedServletContainerFactory servletContainer() { TomcatEmbeddedServletContainerFactory factory = new TomcatEmbeddedServletContainerFactory(); return factory; }
Example #21
Source File: TomcatConfig.java From macrozheng-mall with MIT License | 4 votes |
@Bean public EmbeddedServletContainerFactory servletContainer() { TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory(); tomcat.addAdditionalTomcatConnectors(createStandardConnector()); // 添加http return tomcat; }
Example #22
Source File: TomcatConfig.java From xmall with MIT License | 4 votes |
@Bean public EmbeddedServletContainerFactory servletContainer() { TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory(); tomcat.addAdditionalTomcatConnectors(createStandardConnector()); // 添加http return tomcat; }
Example #23
Source File: TomcatConfig.java From enhanced-pet-clinic with Apache License 2.0 | 4 votes |
@Bean public EmbeddedServletContainerFactory getServletContainer() { TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory(); tomcat.addAdditionalTomcatConnectors(createSslConnector()); return tomcat; }