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

Java HTTP2CServerConnectionFactory类代码示例

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

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



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

示例1: startHttp2

import org.eclipse.jetty.http2.server.HTTP2CServerConnectionFactory; //导入依赖的package包/类
private static Server startHttp2() throws Exception {
    Server server = new Server();
    // Common HTTP configuration.
    HttpConfiguration config = new HttpConfiguration();

    // HTTP/1.1 support.
    HttpConnectionFactory http1 = new HttpConnectionFactory(config);

    // HTTP/2 cleartext support.
    HTTP2CServerConnectionFactory http2c = new HTTP2CServerConnectionFactory(config);

    // Add the connector.
    ServerConnector connector = new ServerConnector(server, http1, http2c);
    connector.setPort(0);
    server.addConnector(connector);

    // Add the servlet.
    ServletHandler handler = new ServletHandler();
    handler.addServletWithMapping(newServletHolder(thriftServlet), TSERVLET_PATH);
    server.setHandler(handler);

    // Start the server.
    server.start();
    return server;
}
 
开发者ID:line,项目名称:armeria,代码行数:26,代码来源:ThriftOverHttpClientTServletIntegrationTest.java


示例2: http

import org.eclipse.jetty.http2.server.HTTP2CServerConnectionFactory; //导入依赖的package包/类
private ServerConnector http(final Server server, final Config conf, final String path,
    final boolean http2) {
  HttpConfiguration httpConfig = conf(new HttpConfiguration(), conf.withoutPath(CONNECTOR),
      path);

  ServerConnector connector;
  if (http2) {
    connector = new ServerConnector(server, new HttpConnectionFactory(httpConfig),
        new HTTP2CServerConnectionFactory(httpConfig));
  } else {
    connector = new ServerConnector(server, new HttpConnectionFactory(httpConfig));
  }

  return conf(connector, conf.getConfig(CONNECTOR), path + "." + CONNECTOR);
}
 
开发者ID:jooby-project,项目名称:jooby,代码行数:16,代码来源:JettyServer.java


示例3: setup

import org.eclipse.jetty.http2.server.HTTP2CServerConnectionFactory; //导入依赖的package包/类
@Override
public ConnectionFactory setup(final HttpConfiguration config) {
    return new HTTP2CServerConnectionFactory(config);
}
 
开发者ID:spotify,项目名称:heroic,代码行数:5,代码来源:Http2CJettyConnectionFactory.java


示例4: init

import org.eclipse.jetty.http2.server.HTTP2CServerConnectionFactory; //导入依赖的package包/类
/**
 * Inits the.
 *
 * @throws Exception
 *             the exception
 */
public final void init() throws Exception {
	initialised = true;
	server = new Server();
	Security.addProvider(new BouncyCastleProvider());
	// Setup JMX
	final MBeanContainer mbContainer = new MBeanContainer(ManagementFactory.getPlatformMBeanServer());
	server.addBean(mbContainer);

	// Enable parsing of jndi-related parts of web.xml and jetty-env.xml
	final org.eclipse.jetty.webapp.Configuration.ClassList classlist = org.eclipse.jetty.webapp.Configuration.ClassList
			.setServerDefault(server);
	classlist.addAfter("org.eclipse.jetty.webapp.FragmentConfiguration",
			"org.eclipse.jetty.plus.webapp.EnvConfiguration", "org.eclipse.jetty.plus.webapp.PlusConfiguration");
	classlist.addBefore("org.eclipse.jetty.webapp.JettyWebXmlConfiguration",
			"org.eclipse.jetty.annotations.AnnotationConfiguration");

	
	
	
   HttpConfiguration http_config = new HttpConfiguration();
   http_config.setSecureScheme("https");
   http_config.setSecurePort(28443);
     
   HttpConfiguration https_config = new HttpConfiguration(http_config);
   https_config.addCustomizer(new SecureRequestCustomizer());

	SslContextFactory sslContextFactory = new SslContextFactory();
	sslContextFactory.setKeyStoreType("JKS");
	sslContextFactory.setKeyStorePath("target/keystore.jceks");
	sslContextFactory.setTrustStorePath("target/keystore.jceks");		
	sslContextFactory.setKeyStorePassword("changeit");
	sslContextFactory.setTrustStorePassword("changeit");
	sslContextFactory.setKeyManagerPassword("changeit");
	sslContextFactory.setCertAlias("jetty");
	sslContextFactory.setIncludeCipherSuites("TLS_DHE_RSA.*","TLS_ECDHE.*");
	sslContextFactory.setExcludeProtocols("SSL","SSLv2","SSLv2Hello","SSLv3","TLSv1","TLSv1.1");
	sslContextFactory.setIncludeProtocols("TLSv1.2");		
	
	ServerConnector sslConnector = new ServerConnector(server, new SslConnectionFactory(sslContextFactory, "http/1.1"), new HttpConnectionFactory(https_config),new HTTP2CServerConnectionFactory(https_config));
	sslConnector.setPort(PORT);
	
	server.setConnectors(new ServerConnector[] { sslConnector });
	final WebAppContext handler = new WebAppContext("src/main/webapp", "/");
	handler.setExtraClasspath("target/classes");
	handler.setParentLoaderPriority(true);
	handler.setConfigurationDiscovered(true);
	handler.setClassLoader(Thread.currentThread().getContextClassLoader());
	final HandlerList handlers = new HandlerList();

	handlers.setHandlers(new Handler[] { handler, new DefaultHandler() });

	server.setHandler(handlers);


}
 
开发者ID:Hack23,项目名称:cia,代码行数:62,代码来源:CitizenIntelligenceAgencyServer.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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