Java Code Examples for org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory#addAdditionalTomcatConnectors()
The following examples show how to use
org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory#addAdditionalTomcatConnectors() .
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: 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 2
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 3
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 4
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 5
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 6
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 7
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 8
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 9
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 10
Source File: AjpConfiguration.java From osiam with MIT License | 5 votes |
@Override public void customize(ConfigurableEmbeddedServletContainer container) { if (container instanceof TomcatEmbeddedServletContainerFactory) { TomcatEmbeddedServletContainerFactory tomcat = (TomcatEmbeddedServletContainerFactory) container; Connector ajpConnector = new Connector("AJP/1.3"); ajpConnector.setAttribute("address", bindAddress); ajpConnector.setPort(port); ajpConnector.setSecure(false); ajpConnector.setAllowTrace(false); ajpConnector.setScheme("http"); tomcat.addAdditionalTomcatConnectors(ajpConnector); } }
Example 11
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 12
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 13
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 14
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; }