本文整理汇总了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;未经允许,请勿转载。 |
请发表评论