当前位置: 首页>>代码示例>>Java>>正文


Java AbstractHttp11Protocol类代码示例

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


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

示例1: servletContainerCustomizer

import org.apache.coyote.http11.AbstractHttp11Protocol; //导入依赖的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

示例2: customizeCompression

import org.apache.coyote.http11.AbstractHttp11Protocol; //导入依赖的package包/类
private void customizeCompression(Connector connector) {
	ProtocolHandler handler = connector.getProtocolHandler();
	if (handler instanceof AbstractHttp11Protocol) {
		AbstractHttp11Protocol<?> protocol = (AbstractHttp11Protocol<?>) handler;
		Compression compression = getCompression();
		protocol.setCompression("on");
		protocol.setCompressionMinSize(compression.getMinResponseSize());
		protocol.setCompressableMimeType(
				StringUtils.arrayToCommaDelimitedString(compression.getMimeTypes()));
		if (getCompression().getExcludedUserAgents() != null) {
			protocol.setNoCompressionUserAgents(
					StringUtils.arrayToCommaDelimitedString(
							getCompression().getExcludedUserAgents()));
		}
	}
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:17,代码来源:TomcatEmbeddedServletContainerFactory.java

示例3: customizeMaxHttpHeaderSize

import org.apache.coyote.http11.AbstractHttp11Protocol; //导入依赖的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

示例4: customizeCompression

import org.apache.coyote.http11.AbstractHttp11Protocol; //导入依赖的package包/类
private void customizeCompression(Connector connector) {
	ProtocolHandler handler = connector.getProtocolHandler();
	if (handler instanceof AbstractHttp11Protocol) {
		AbstractHttp11Protocol<?> protocol = (AbstractHttp11Protocol<?>) handler;
		Compression compression = getCompression();
		protocol.setCompression("on");
		protocol.setCompressionMinSize(compression.getMinResponseSize());
		protocol.setCompressableMimeTypes(
				StringUtils.arrayToCommaDelimitedString(compression.getMimeTypes()));
		if (getCompression().getExcludedUserAgents() != null) {
			protocol.setNoCompressionUserAgents(
					StringUtils.arrayToCommaDelimitedString(
							getCompression().getExcludedUserAgents()));
		}
	}
}
 
开发者ID:philwebb,项目名称:spring-boot-concourse,代码行数:17,代码来源:TomcatEmbeddedServletContainerFactory.java

示例5: servletContainerCustomizer

import org.apache.coyote.http11.AbstractHttp11Protocol; //导入依赖的package包/类
@Bean
public EmbeddedServletContainerCustomizer servletContainerCustomizer() {
    return servletContainer -> {
        addMimeMappingsForFonts(servletContainer);

        TomcatEmbeddedServletContainerFactory container = (TomcatEmbeddedServletContainerFactory) servletContainer;

        container.setRegisterJspServlet(false);

        container.addContextCustomizers(customizer -> customizer.addWelcomeFile("index.html"));
        container.addConnectorCustomizers(
                connector -> {
                    AbstractHttp11Protocol httpProtocol = (AbstractHttp11Protocol) connector.getProtocolHandler();
                    httpProtocol.setCompression("on");
                    httpProtocol.setCompressionMinSize(256);
                    httpProtocol.setCompressableMimeTypes(COMPRESSIBLE_MEDIA_TYPES);
                }
        );
    };
}
 
开发者ID:servicosgovbr,项目名称:portal-de-servicos,代码行数:21,代码来源:ServletContainerConfig.java

示例6: customizeMaxHttpHeaderSize

import org.apache.coyote.http11.AbstractHttp11Protocol; //导入依赖的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.apache.coyote.http11.AbstractHttp11Protocol; //导入依赖的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: servletContainerCustomizer

import org.apache.coyote.http11.AbstractHttp11Protocol; //导入依赖的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

示例9: servletContainerCustomizer

import org.apache.coyote.http11.AbstractHttp11Protocol; //导入依赖的package包/类
@Bean
public EmbeddedServletContainerCustomizer servletContainerCustomizer() {
    return servletContainer -> ((TomcatEmbeddedServletContainerFactory) servletContainer).addConnectorCustomizers(
            connector -> {
                AbstractHttp11Protocol httpProtocol = (AbstractHttp11Protocol) connector.getProtocolHandler();
                httpProtocol.setCompression("on");
                httpProtocol.setCompressionMinSize(256);
                String mimeTypes = httpProtocol.getCompressableMimeTypes();
                mimeTypes += "," + MediaType.APPLICATION_JSON_VALUE;
                mimeTypes += "," + "text/css";
                mimeTypes += "," + "application/javascript";
                httpProtocol.setCompressableMimeTypes(mimeTypes);
            }
    );
}
 
开发者ID:bkielczewski,项目名称:akanke,代码行数:16,代码来源:TomcatConfig.java

示例10: servletContainerCustomizer

import org.apache.coyote.http11.AbstractHttp11Protocol; //导入依赖的package包/类
@Bean
EmbeddedServletContainerCustomizer servletContainerCustomizer() {
    return servletContainer -> ((TomcatEmbeddedServletContainerFactory) servletContainer)
            .addConnectorCustomizers(connector -> {
                AbstractHttp11Protocol<?> httpProtocol = (AbstractHttp11Protocol<?>) connector.getProtocolHandler();
                httpProtocol.setCompression("on");
                httpProtocol.setCompressionMinSize(256);
                String mimeTypes = httpProtocol.getCompressableMimeTypes();
                String mimeTypesWithJson = mimeTypes + "," + MediaType.APPLICATION_JSON_VALUE + ",application/javascript";
                httpProtocol.setCompressableMimeTypes(mimeTypesWithJson);
            });
}
 
开发者ID:GJRTimmer,项目名称:vaadin-security-template,代码行数:13,代码来源:Application.java

示例11: createConnector

import org.apache.coyote.http11.AbstractHttp11Protocol; //导入依赖的package包/类
@Test
public void createConnector() {
    final AtomicReference<Connector> connector = new AtomicReference<>();
    try {
        new Container(new Configuration()
                .property("connector.xpoweredBy", "true")
                .property("connector.attributes.compression", "true")
                .property("connector.attributes.maxHeaderCount", "2016")) {

            @Override
            protected Connector createConnector() {
                final Connector connector1 = super.createConnector();
                connector.set(connector1);
                throw new RuntimeException("end");
            }
        };
        fail("we throw an exception to prevent startup");
    } catch (final Exception re) {
        assertEquals(re.getMessage(), "java.lang.RuntimeException: end", re.getMessage());

        final Connector c = connector.get();
        assertNotNull(c);
        assertTrue(c.getXpoweredBy());
        assertEquals(2016, AbstractHttp11Protocol.class.cast(c.getProtocolHandler()).getMaxHeaderCount());
        assertEquals("true", AbstractHttp11Protocol.class.cast(c.getProtocolHandler()).getCompression());
    }
}
 
开发者ID:apache,项目名称:tomee,代码行数:28,代码来源:ConnectorConfigTest.java

示例12: servletContainerCustomizer

import org.apache.coyote.http11.AbstractHttp11Protocol; //导入依赖的package包/类
@Bean
public EmbeddedServletContainerCustomizer servletContainerCustomizer() {
  return (factory) -> ((TomcatEmbeddedServletContainerFactory) factory)
      .addConnectorCustomizers((connector) -> ((AbstractHttp11Protocol<?>) connector.getProtocolHandler())
          .setUseServerCipherSuitesOrder(Boolean.toString(true)));
}
 
开发者ID:cloudfoundry-incubator,项目名称:credhub,代码行数:7,代码来源:CredentialManagerApp.java

示例13: initialize

import org.apache.coyote.http11.AbstractHttp11Protocol; //导入依赖的package包/类
public void initialize() {
		try {
			JFishTomcat tomcat = new JFishTomcat();
			if(serverConfig.getTomcatContextClassName()!=null){
				tomcat.setContextClass((Class<StandardContext>)ReflectUtils.loadClass(serverConfig.getTomcatContextClassName(), true));
			}
			int port = serverConfig.getPort();
			tomcat.setPort(port);
//			tomcat.setBaseDir(webConfig.getServerBaseDir());
			String baseDir = null;
			if(!Utils.isBlank(serverConfig.getServerBaseDir())){
				baseDir = serverConfig.getServerBaseDir();
			}else{
				baseDir = System.getProperty("java.io.tmpdir");
				logger.info("set serverBaseDir as java.io.tmpdir : {} ", baseDir);
			}
			tomcat.setBaseDir(baseDir);
			
			// This magic line makes Tomcat look for WAR files in catalinaHome/webapps
			// and automatically deploy them
//			tomcat.getHost().addLifecycleListener(new HostConfig());
			appBaseFile = new File(baseDir+"/tomcat.webapps."+this.serverConfig.getPort());
			if(!appBaseFile.exists()){
				appBaseFile.mkdirs();
			}
			appBaseFile.deleteOnExit();
			tomcat.getHost().setAppBase(appBaseFile.getAbsolutePath());
			Connector connector = tomcat.getConnector();
			connector.setURIEncoding("UTF-8");
			connector.setRedirectPort(serverConfig.getRedirectPort());
			connector.setMaxPostSize(serverConfig.getMaxPostSize());
			
			ProtocolHandler protocol = connector.getProtocolHandler();
			if(protocol instanceof AbstractHttp11Protocol){
				/*****
				 * <Connector port="8080" protocol="HTTP/1.1" 
					   connectionTimeout="20000" 
   						redirectPort="8181" compression="500" 
  						compressableMimeType="text/html,text/xml,text/plain,application/octet-stream" />
				 */
				AbstractHttp11Protocol<?> hp = (AbstractHttp11Protocol<?>) protocol;
				hp.setCompression("on");
				hp.setCompressableMimeTypes("text/html,text/xml,text/plain,application/octet-stream");
			}
			
			
			StandardServer server = (StandardServer) tomcat.getServer();
			AprLifecycleListener listener = new AprLifecycleListener();
			server.addLifecycleListener(listener);

			/*tomcat.addUser("adminuser", "adminuser");
			tomcat.addRole("adminuser", "admin");
			tomcat.addRole("adminuser", "admin");*/
			
			this.tomcat = tomcat;
		} catch (Exception e) {
			throw new RuntimeException("web server initialize error , check it. " + e.getMessage(), e);
		}
		
		/*Runtime.getRuntime().addShutdownHook(new Thread(){

			@Override
			public void run() {
				appBaseFile.delete();
			}
			
		});*/
	}
 
开发者ID:wayshall,项目名称:onetwo,代码行数:69,代码来源:TomcatServer.java


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