• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java TomcatConnectorCustomizer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.springframework.boot.context.embedded.tomcat.TomcatConnectorCustomizer的典型用法代码示例。如果您正苦于以下问题:Java TomcatConnectorCustomizer类的具体用法?Java TomcatConnectorCustomizer怎么用?Java TomcatConnectorCustomizer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TomcatConnectorCustomizer类属于org.springframework.boot.context.embedded.tomcat包,在下文中一共展示了TomcatConnectorCustomizer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: servletContainer

import org.springframework.boot.context.embedded.tomcat.TomcatConnectorCustomizer; //导入依赖的package包/类
@Bean
public EmbeddedServletContainerFactory servletContainer() {
    TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory();

    tomcat.addConnectorCustomizers((TomcatConnectorCustomizer) connector -> {
        connector.setScheme("https");
        connector.setPort(cfg.getPort());
        Http11NioProtocol protocol = (Http11NioProtocol) connector.getProtocolHandler();
        protocol.setSSLEnabled(true);
        protocol.setSSLCertificateKeyFile(cfg.getKey());
        protocol.setSSLCertificateFile(cfg.getCert());
        cfg.getChain().ifPresent(protocol::setSSLCertificateChainFile);
    });

    return tomcat;
}
 
开发者ID:kamax-io,项目名称:mxhsd,代码行数:17,代码来源:MxhsdFederationApp.java


示例2: customize

import org.springframework.boot.context.embedded.tomcat.TomcatConnectorCustomizer; //导入依赖的package包/类
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
  if (!(container instanceof TomcatEmbeddedServletContainerFactory)) {
    return;
  }
  if (!environment.containsProperty(TOMCAT_ACCEPTOR_COUNT)) {
    return;
  }
  TomcatEmbeddedServletContainerFactory tomcat =
      (TomcatEmbeddedServletContainerFactory) container;
  tomcat.addConnectorCustomizers(new TomcatConnectorCustomizer() {
    @Override
    public void customize(Connector connector) {
      ProtocolHandler handler = connector.getProtocolHandler();
      if (handler instanceof Http11NioProtocol) {
        Http11NioProtocol http = (Http11NioProtocol) handler;
        int acceptCount = Integer.parseInt(environment.getProperty(TOMCAT_ACCEPTOR_COUNT));
        http.setBacklog(acceptCount);
        logger.info("Setting tomcat accept count to {}", acceptCount);
      }

    }
  });
}
 
开发者ID:dewey-its,项目名称:apollo-custom,代码行数:25,代码来源:TomcatContainerCustomizer.java


示例3: servletContainerCustomizer

import org.springframework.boot.context.embedded.tomcat.TomcatConnectorCustomizer; //导入依赖的package包/类
@Bean
public EmbeddedServletContainerCustomizer servletContainerCustomizer()
{
	return new EmbeddedServletContainerCustomizer()
	{
		@Override
		public void customize(final ConfigurableEmbeddedServletContainer servletContainer)
		{
			final TomcatEmbeddedServletContainerFactory tomcatContainerFactory = (TomcatEmbeddedServletContainerFactory)servletContainer;
			tomcatContainerFactory.addConnectorCustomizers(new TomcatConnectorCustomizer()
			{
				@Override
				public void customize(final Connector connector)
				{
					final AbstractHttp11Protocol<?> httpProtocol = (AbstractHttp11Protocol<?>)connector.getProtocolHandler();
					httpProtocol.setCompression("on");
					httpProtocol.setCompressionMinSize(256);
					final String mimeTypes = httpProtocol.getCompressibleMimeType();
					final String mimeTypesWithJson = mimeTypes + "," + MediaType.APPLICATION_JSON_VALUE + ",application/javascript";
					httpProtocol.setCompressibleMimeType(mimeTypesWithJson);
				}
			});
		}
	};
}
 
开发者ID:metasfresh,项目名称:metasfresh-webui-api,代码行数:26,代码来源:WebRestApiApplication.java


示例4: customizeMaxHttpHeaderSize

import org.springframework.boot.context.embedded.tomcat.TomcatConnectorCustomizer; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
private void customizeMaxHttpHeaderSize(
		TomcatEmbeddedServletContainerFactory factory,
		final int maxHttpHeaderSize) {
	factory.addConnectorCustomizers(new TomcatConnectorCustomizer() {

		@Override
		public void customize(Connector connector) {
			ProtocolHandler handler = connector.getProtocolHandler();
			if (handler instanceof AbstractHttp11Protocol) {
				AbstractHttp11Protocol protocol = (AbstractHttp11Protocol) handler;
				protocol.setMaxHttpHeaderSize(maxHttpHeaderSize);
			}
		}

	});
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:18,代码来源:ServerProperties.java


示例5: containerCustomizer

import org.springframework.boot.context.embedded.tomcat.TomcatConnectorCustomizer; //导入依赖的package包/类
/**
 * Container customizer. Configures the embedded tomcat (e.g. post size)
 *
 * @return the embedded servlet container customizer
 * @throws Exception the exception
 */
@Bean 
public EmbeddedServletContainerCustomizer containerCustomizer(
        ) throws Exception {
 
      
      return new EmbeddedServletContainerCustomizer() {
		@Override
		public void customize(ConfigurableEmbeddedServletContainer container) {

		      if (container instanceof TomcatEmbeddedServletContainerFactory) {

		          TomcatEmbeddedServletContainerFactory tomcat = (TomcatEmbeddedServletContainerFactory) container;
		          tomcat.addConnectorCustomizers(
		                  new TomcatConnectorCustomizer() {
							@Override
							public void customize(Connector connector) {
								  connector.setMaxPostSize(20000000);//20MB
							  }
						}
		          );
		      }
		  }
	};
  }
 
开发者ID:andju,项目名称:findlunch,代码行数:31,代码来源:Beans.java


示例6: customizeMaxHttpHeaderSize

import org.springframework.boot.context.embedded.tomcat.TomcatConnectorCustomizer; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
private void customizeMaxHttpHeaderSize(
		TomcatEmbeddedServletContainerFactory factory) {
	factory.addConnectorCustomizers(new TomcatConnectorCustomizer() {

		@Override
		public void customize(Connector connector) {
			ProtocolHandler handler = connector.getProtocolHandler();
			if (handler instanceof AbstractHttp11Protocol) {
				AbstractHttp11Protocol protocol = (AbstractHttp11Protocol) handler;
				protocol.setMaxHttpHeaderSize(Tomcat.this.maxHttpHeaderSize);
			}
		}

	});
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:17,代码来源:ServerProperties.java


示例7: servletContainerCustomizer

import org.springframework.boot.context.embedded.tomcat.TomcatConnectorCustomizer; //导入依赖的package包/类
@Bean
public EmbeddedServletContainerCustomizer servletContainerCustomizer(){
	return configurableEmbeddedServletContainer -> 
			((TomcatEmbeddedServletContainerFactory) configurableEmbeddedServletContainer).addConnectorCustomizers(
			new TomcatConnectorCustomizer() {
				@Override
				public void customize(Connector connector) {
					AbstractHttp11Protocol httpProtocol = (AbstractHttp11Protocol) connector.getProtocolHandler();
					httpProtocol.setCompression("on");
					httpProtocol.setCompressionMinSize(256);
					String mimeTypes = httpProtocol.getCompressableMimeTypes();
					String mimeTypesWithJson = mimeTypes + "," + MediaType.APPLICATION_JSON_VALUE;
					httpProtocol.setCompressableMimeTypes(mimeTypesWithJson);
				}
			}
	);
}
 
开发者ID:oncoblocks,项目名称:centromere,代码行数:18,代码来源:WebServicesConfig.java


示例8: embeddedServletContainerCustomizer

import org.springframework.boot.context.embedded.tomcat.TomcatConnectorCustomizer; //导入依赖的package包/类
@Bean
public EmbeddedServletContainerCustomizer embeddedServletContainerCustomizer() {

    return new EmbeddedServletContainerCustomizer() {

        @Override
        public void customize(final ConfigurableEmbeddedServletContainer container) {
            if (container instanceof TomcatEmbeddedServletContainerFactory) {
                TomcatEmbeddedServletContainerFactory tomcat = (TomcatEmbeddedServletContainerFactory) container;
                for (TomcatConnectorCustomizer customizer : tomcatConnectorCustomizers) {
                    tomcat.addConnectorCustomizers(customizer);
                }
            }
        }
    };
}
 
开发者ID:zalando-stups,项目名称:booties,代码行数:17,代码来源:ProxiesAutoConfiguration.java


示例9: servletContainer

import org.springframework.boot.context.embedded.tomcat.TomcatConnectorCustomizer; //导入依赖的package包/类
@Bean
public EmbeddedServletContainerFactory servletContainer() throws Exception {
    TomcatEmbeddedServletContainerFactory factory = new TomcatEmbeddedServletContainerFactory();

    int apiPort = Utils.getSystemPort(Constants.SYS_API_PORT);
    factory.setPort(apiPort);
    factory.setSessionTimeout(10, TimeUnit.MINUTES);
    factory.setContextPath("/testproxy");
    baseDirectory = new File("./tmp");
    factory.setBaseDirectory(baseDirectory);
    List<TomcatConnectorCustomizer> cs = new ArrayList();
    cs.add(tomcatConnectorCustomizers());
    factory.setTomcatConnectorCustomizers(cs);

    if (Utils.getEnvironmentOptionValue(Constants.SYS_LOGGING_DISABLED) != null) {
        HistoryService.getInstance().disableHistory();
    }
    return factory;
}
 
开发者ID:groupon,项目名称:odo,代码行数:20,代码来源:HomeController.java


示例10: servletContainer

import org.springframework.boot.context.embedded.tomcat.TomcatConnectorCustomizer; //导入依赖的package包/类
@Bean
public EmbeddedServletContainerFactory servletContainer() {
    TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory();

    tomcat.addConnectorCustomizers((TomcatConnectorCustomizer) connector -> {
        connector.setScheme("http");
        connector.setPort(cfg.getPort());
    });

    return tomcat;
}
 
开发者ID:kamax-io,项目名称:mxhsd,代码行数:12,代码来源:MxhsdClientApp.java


示例11: customizeTomcat

import org.springframework.boot.context.embedded.tomcat.TomcatConnectorCustomizer; //导入依赖的package包/类
public void customizeTomcat(TomcatEmbeddedServletContainerFactory factory) {
	factory.addConnectorCustomizers(new TomcatConnectorCustomizer() {
		@Override
		public void customize(Connector connector) {
			Object defaultMaxThreads = connector.getAttribute("maxThreads");
			connector.setAttribute("maxThreads", MAX_THREADS);
			LOG.info("Changed Tomcat connector maxThreads from " + defaultMaxThreads + " to " + MAX_THREADS);
		}
	});
}
 
开发者ID:Myazure,项目名称:weixin_component,代码行数:11,代码来源:MyazureEmbeddedServletContainerCustomizer.java


示例12: customizeMaxThreads

import org.springframework.boot.context.embedded.tomcat.TomcatConnectorCustomizer; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
private void customizeMaxThreads(TomcatEmbeddedServletContainerFactory factory) {
	factory.addConnectorCustomizers(new TomcatConnectorCustomizer() {
		@Override
		public void customize(Connector connector) {

			ProtocolHandler handler = connector.getProtocolHandler();
			if (handler instanceof AbstractProtocol) {
				AbstractProtocol protocol = (AbstractProtocol) handler;
				protocol.setMaxThreads(Tomcat.this.maxThreads);
			}

		}
	});
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:16,代码来源:ServerProperties.java


示例13: customizeMinThreads

import org.springframework.boot.context.embedded.tomcat.TomcatConnectorCustomizer; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
private void customizeMinThreads(TomcatEmbeddedServletContainerFactory factory) {
	factory.addConnectorCustomizers(new TomcatConnectorCustomizer() {
		@Override
		public void customize(Connector connector) {

			ProtocolHandler handler = connector.getProtocolHandler();
			if (handler instanceof AbstractProtocol) {
				AbstractProtocol protocol = (AbstractProtocol) handler;
				protocol.setMinSpareThreads(Tomcat.this.minSpareThreads);
			}

		}
	});
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:16,代码来源:ServerProperties.java


示例14: customizeMaxHttpPostSize

import org.springframework.boot.context.embedded.tomcat.TomcatConnectorCustomizer; //导入依赖的package包/类
private void customizeMaxHttpPostSize(
		TomcatEmbeddedServletContainerFactory factory,
		final int maxHttpPostSize) {
	factory.addConnectorCustomizers(new TomcatConnectorCustomizer() {

		@Override
		public void customize(Connector connector) {
			connector.setMaxPostSize(maxHttpPostSize);
		}

	});
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:13,代码来源:ServerProperties.java


示例15: servletContainerCustomizer

import org.springframework.boot.context.embedded.tomcat.TomcatConnectorCustomizer; //导入依赖的package包/类
/**
 * Configure embedded tomcat so that is use gzip for various resources.
 */
@Bean
public EmbeddedServletContainerCustomizer servletContainerCustomizer()
{
	return new EmbeddedServletContainerCustomizer()
	{
		@Override
		public void customize(final ConfigurableEmbeddedServletContainer servletContainer)
		{
			final TomcatEmbeddedServletContainerFactory tomcatContainerFactory = (TomcatEmbeddedServletContainerFactory)servletContainer;
			tomcatContainerFactory.addConnectorCustomizers(new TomcatConnectorCustomizer()
			{
				@Override
				public void customize(final Connector connector)
				{
					final AbstractHttp11Protocol<?> httpProtocol = (AbstractHttp11Protocol<?>)connector.getProtocolHandler();
					httpProtocol.setCompression("on");
					httpProtocol.setCompressionMinSize(256);
					final StringBuffer mimeTypes = new StringBuffer(httpProtocol.getCompressableMimeType());
					if(!mimeTypes.toString().contains("MediaType.APPLICATION_JSON_VALUE"))
					{
						mimeTypes.append(","+MediaType.APPLICATION_JSON_VALUE);
					}
					if(!mimeTypes.toString().contains("application/javascript"))
					{
						mimeTypes.append(",application/javascript");
					}
					httpProtocol.setCompressableMimeType(mimeTypes.toString());
				}
			});
		}
	};
}
 
开发者ID:metasfresh,项目名称:metasfresh-procurement-webui,代码行数:36,代码来源:Application.java


示例16: containerCustomizer

import org.springframework.boot.context.embedded.tomcat.TomcatConnectorCustomizer; //导入依赖的package包/类
@Bean
@Autowired
public EmbeddedServletContainerCustomizer containerCustomizer() {
  Boolean httpsEnabled = environment.getProperty(PutPutConfiguration.HTTPS_ENABLED, Boolean.class, false);

  String keystoreFile = environment.getProperty("keystore.file", "classpath:keystore.jks");
  String keystorePassword = environment.getProperty("keystore.password", "password");
  String keystoreType = environment.getProperty("keystore.type", "jks");
  String keystoreAlias = environment.getProperty("keystore.alias");

  return (ConfigurableEmbeddedServletContainer factory) -> {
    TomcatEmbeddedServletContainerFactory containerFactory = (TomcatEmbeddedServletContainerFactory) factory;

    if (httpsEnabled) {
      final String absoluteKeystoreFile = getKeyStoreFilePath(keystoreFile);

      containerFactory.addConnectorCustomizers((TomcatConnectorCustomizer) (Connector connector) -> {
        connector.setSecure(true);
        connector.setScheme("https");
        connector.setAttribute("keystoreFile", absoluteKeystoreFile);
        connector.setAttribute("keystorePass", keystorePassword);
        connector.setAttribute("keystoreType", keystoreType);

        if (keystoreAlias != null) {
          connector.setAttribute("keyAlias", keystoreAlias);
        }

        connector.setAttribute("clientAuth", "false");
        connector.setAttribute("sslProtocol", "TLS");
        connector.setAttribute("SSLEnabled", true);
      });
    }
  };
}
 
开发者ID:adrobisch,项目名称:putput,代码行数:35,代码来源:HttpsConfig.java


示例17: containerCustomizer

import org.springframework.boot.context.embedded.tomcat.TomcatConnectorCustomizer; //导入依赖的package包/类
@Bean
public EmbeddedServletContainerCustomizer containerCustomizer() throws FileNotFoundException {
    final String absoluteKeystoreFile = ResourceUtils.getFile(keystoreFile).getAbsolutePath();

    return new EmbeddedServletContainerCustomizer() {

        @Override
        public void customize(final ConfigurableEmbeddedServletContainer factory) {
            if(factory instanceof TomcatEmbeddedServletContainerFactory) {
                TomcatEmbeddedServletContainerFactory containerFactory = (TomcatEmbeddedServletContainerFactory) factory;
                containerFactory.addConnectorCustomizers(new TomcatConnectorCustomizer() {

                    @Override
                    public void customize(final Connector connector) {
                        connector.setPort(getPortNumber());
                        connector.setSecure(true);
                        connector.setScheme("https");
                        Http11NioProtocol proto = (Http11NioProtocol) connector.getProtocolHandler();
                        proto.setSSLEnabled(true);
                        proto.setKeystoreFile(absoluteKeystoreFile);
                        proto.setKeystorePass(keystorePass);
                        proto.setKeystoreType("PKCS12");
                    }
                });
            }
        }
    };
}
 
开发者ID:JohnCannon87,项目名称:Hammerhead-StatsCollector,代码行数:29,代码来源:Application.java


示例18: containerCustomizer

import org.springframework.boot.context.embedded.tomcat.TomcatConnectorCustomizer; //导入依赖的package包/类
@Bean
  EmbeddedServletContainerCustomizer containerCustomizer(
          @Value("${keystore.file:src/main/resources/private/keystore}") String keystoreFile,
          @Value("${keystore.pass:changeit}") final String keystorePass) throws Exception {

// If you were going to reuse this class in another
// application, this is one of the key sections that you
// would want to change
  	
      final String absoluteKeystoreFile = new File(keystoreFile).getAbsolutePath();

      return new EmbeddedServletContainerCustomizer () {

	@Override
	public void customize(ConfigurableEmbeddedServletContainer container) {
            TomcatEmbeddedServletContainerFactory tomcat = (TomcatEmbeddedServletContainerFactory) container;
            tomcat.addConnectorCustomizers(
                    new TomcatConnectorCustomizer() {
						@Override
						public void customize(Connector connector) {
							connector.setPort(8443);
	                        connector.setSecure(true);
	                        connector.setScheme("https");

	                        Http11NioProtocol proto = (Http11NioProtocol) connector.getProtocolHandler();
	                        proto.setSSLEnabled(true);
	                        proto.setKeystoreFile(absoluteKeystoreFile);
	                        proto.setKeystorePass(keystorePass);
	                        proto.setKeystoreType("JKS");
	                        proto.setKeyAlias("tomcat");
						}
                    });
    
	}
      };
  }
 
开发者ID:juleswhite,项目名称:mobilecloud-15,代码行数:37,代码来源:OAuth2SecurityConfiguration.java


示例19: customizeTomcat

import org.springframework.boot.context.embedded.tomcat.TomcatConnectorCustomizer; //导入依赖的package包/类
public void customizeTomcat(TomcatEmbeddedServletContainerFactory factory) {
    factory.addConnectorCustomizers(new TomcatConnectorCustomizer() {
      @Override
      public void customize(Connector connector) {
    	  connector.setPort(80);
//        Object defaultMaxThreads = connector.getAttribute("maxThreads");
//        connector.getAttribute("javax.faces.CLIENT_WINDOW_MODE")
        connector.setAttribute("maxThreads", MAX_THREADS);
      }
    });
  }
 
开发者ID:stephanrauh,项目名称:JSF-on-Spring-Boot,代码行数:12,代码来源:Port80ServletContainerCustomizer.java


示例20: customizeTomcat

import org.springframework.boot.context.embedded.tomcat.TomcatConnectorCustomizer; //导入依赖的package包/类
public void customizeTomcat(TomcatEmbeddedServletContainerFactory factory) {
    factory.addConnectorCustomizers(new TomcatConnectorCustomizer() {
        @Override
        public void customize(Connector connector) {
            Object defaultMaxThreads = connector.getAttribute("maxThreads");
            connector.setAttribute("maxThreads", MAX_THREADS);
            LOG.info("Changed Tomcat connector maxThreads from " + defaultMaxThreads + " to " + MAX_THREADS);
        }
    });
}
 
开发者ID:callistaenterprise,项目名称:blog-non-blocking-rest-service-with-spring-mvc,代码行数:11,代码来源:MyEmbeddedServletContainerCustomizer.java



注:本文中的org.springframework.boot.context.embedded.tomcat.TomcatConnectorCustomizer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AntlrProposalConflictHelper类代码示例发布时间:2022-05-21
下一篇:
Java DefaultCookie类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap