本文整理汇总了Java中org.eclipse.jetty.alpn.server.ALPNServerConnectionFactory类的典型用法代码示例。如果您正苦于以下问题:Java ALPNServerConnectionFactory类的具体用法?Java ALPNServerConnectionFactory怎么用?Java ALPNServerConnectionFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ALPNServerConnectionFactory类属于org.eclipse.jetty.alpn.server包,在下文中一共展示了ALPNServerConnectionFactory类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createConnectionFactories
import org.eclipse.jetty.alpn.server.ALPNServerConnectionFactory; //导入依赖的package包/类
private ConnectionFactory[] createConnectionFactories(final SslContextFactory sslContextFactory,
final HttpConfiguration httpConfiguration) {
return new ConnectionFactory[] {
new SslConnectionFactory(sslContextFactory, "alpn"),
new ALPNServerConnectionFactory("h2", "h2-17", "h2-16", "h2-15", "h2-14"),
new HTTP2ServerConnectionFactory(httpConfiguration)
};
}
开发者ID:gdrouet,项目名称:nightclazz-spring5,代码行数:9,代码来源:JettyHttp2Customizer.java
示例2: JettyStarter
import org.eclipse.jetty.alpn.server.ALPNServerConnectionFactory; //导入依赖的package包/类
public JettyStarter() {
HttpConnectionFactory httpFactory = new HttpConnectionFactory(config);
HTTP2ServerConnectionFactory http2Factory = new HTTP2ServerConnectionFactory(
config);
ALPNServerConnectionFactory alpn = createAlpnProtocolFactory(httpFactory);
Server server = createServer(httpFactory, http2Factory, alpn);
HandlerWrapper servletHandler = createServletHandlerWithServlet();
HandlerWrapper gzipHandler = createGzipHandler();
gzipHandler.setHandler(servletHandler);
server.setHandler(gzipHandler);
this.server = server;
}
开发者ID:AndreasKl,项目名称:embedded-jetty-http2,代码行数:15,代码来源:Application.java
示例3: createServer
import org.eclipse.jetty.alpn.server.ALPNServerConnectionFactory; //导入依赖的package包/类
private Server createServer(HttpConnectionFactory httpConnectionFactory,
HTTP2ServerConnectionFactory http2ConnectionFactory,
ALPNServerConnectionFactory alpn) {
Server server = new Server();
server.setRequestLog(new AsyncNCSARequestLog());
ServerConnector connector = new ServerConnector(server, prepareSsl(alpn),
alpn, http2ConnectionFactory, httpConnectionFactory);
connector.setPort(SSL_PORT);
server.addConnector(connector);
return server;
}
开发者ID:AndreasKl,项目名称:embedded-jetty-http2,代码行数:14,代码来源:Application.java
示例4: createAlpnProtocolFactory
import org.eclipse.jetty.alpn.server.ALPNServerConnectionFactory; //导入依赖的package包/类
private ALPNServerConnectionFactory createAlpnProtocolFactory(
HttpConnectionFactory httpConnectionFactory) {
NegotiatingServerConnectionFactory.checkProtocolNegotiationAvailable();
ALPNServerConnectionFactory alpn = new ALPNServerConnectionFactory();
alpn.setDefaultProtocol(httpConnectionFactory.getProtocol());
return alpn;
}
开发者ID:AndreasKl,项目名称:embedded-jetty-http2,代码行数:8,代码来源:Application.java
示例5: prepareSsl
import org.eclipse.jetty.alpn.server.ALPNServerConnectionFactory; //导入依赖的package包/类
private SslConnectionFactory prepareSsl(ALPNServerConnectionFactory alpn) {
SslContextFactory sslContextFactory = new SslContextFactory();
sslContextFactory.setKeyStorePath(
Application.class.getResource("/keystore").toExternalForm());
sslContextFactory.setKeyStorePassword("changeit");
sslContextFactory.setCipherComparator(HTTP2Cipher.COMPARATOR);
sslContextFactory.setUseCipherSuitesOrder(true);
SslConnectionFactory ssl = new SslConnectionFactory(sslContextFactory,
alpn.getProtocol());
return ssl;
}
开发者ID:AndreasKl,项目名称:embedded-jetty-http2,代码行数:12,代码来源:Application.java
示例6: configureServerForHttp2
import org.eclipse.jetty.alpn.server.ALPNServerConnectionFactory; //导入依赖的package包/类
/**
* Configure the http2 server.
*
* @param server the server
* @return the server
*/
@VisibleForTesting
Server configureServerForHttp2(Server server) {
// HTTP Configuration
HttpConfiguration http11Config = new HttpConfiguration();
http11Config.setSecureScheme("https");
http11Config.setSecurePort(httpsPort);
// SSL Context Factory for HTTPS and HTTP/2
SslContextFactory sslContextFactory = new SslContextFactory();
sslContextFactory.setKeyStoreResource(newClassPathResource("sample.jks"));
sslContextFactory.setKeyStorePassword("secret");
sslContextFactory.setKeyManagerPassword("secret");
sslContextFactory.setCipherComparator(HTTP2Cipher.COMPARATOR);
sslContextFactory.setUseCipherSuitesOrder(true);
// HTTPS Configuration
HttpConfiguration httpsConfig = new HttpConfiguration(http11Config);
httpsConfig.addCustomizer(new SecureRequestCustomizer());
// HTTP/2 Connection Factory
HTTP2ServerConnectionFactory h2 = new HTTP2ServerConnectionFactory(httpsConfig);
NegotiatingServerConnectionFactory.checkProtocolNegotiationAvailable();
ALPNServerConnectionFactory alpnServerConnectionFactory = new ALPNServerConnectionFactory();
alpnServerConnectionFactory.setDefaultProtocol("h2");
alpnServerConnectionFactory.getALPNProcessor();
// SSL Connection Factory
SslConnectionFactory sslConnectionFactory =
new SslConnectionFactory(sslContextFactory,
alpnServerConnectionFactory.getProtocol());
// HTTP/2 Connector
ServerConnector http2Connector =
new ServerConnector(server, sslConnectionFactory, alpnServerConnectionFactory, h2,
new HttpConnectionFactory(httpsConfig));
http2Connector.setPort(httpPort);
server.addConnector(http2Connector);
return server;
}
开发者ID:janweinschenker,项目名称:servlet4-demo,代码行数:48,代码来源:ApplicationConfig.java
示例7: main
import org.eclipse.jetty.alpn.server.ALPNServerConnectionFactory; //导入依赖的package包/类
public static void main(String... args) throws Exception {
Server server = new Server();
ServletContextHandler context = new ServletContextHandler(server, "/", ServletContextHandler.SESSIONS);
context.addServlet(new ServletHolder(new Servlet()), "/");
server.setHandler(context);
// HTTP Configuration
HttpConfiguration http_config = new HttpConfiguration();
http_config.setSecureScheme("https");
http_config.setSecurePort(8443);
// SSL Context Factory for HTTPS and HTTP/2
SslContextFactory sslContextFactory = new SslContextFactory();
sslContextFactory.setKeyStoreResource(newClassPathResource("keystore"));
sslContextFactory.setKeyStorePassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4");
sslContextFactory.setKeyManagerPassword("OBF:1u2u1wml1z7s1z7a1wnl1u2g");
sslContextFactory.setCipherComparator(HTTP2Cipher.COMPARATOR);
// HTTPS Configuration
HttpConfiguration https_config = new HttpConfiguration(http_config);
https_config.addCustomizer(new SecureRequestCustomizer());
// HTTP/2 Connection Factory
HTTP2ServerConnectionFactory h2 = new MyConnectionFactory(https_config);
NegotiatingServerConnectionFactory.checkProtocolNegotiationAvailable();
ALPNServerConnectionFactory alpn = new ALPNServerConnectionFactory();
alpn.setDefaultProtocol("h2");
// SSL Connection Factory
SslConnectionFactory ssl = new SslConnectionFactory(sslContextFactory,alpn.getProtocol());
// HTTP/2 Connector
ServerConnector http2Connector =
new ServerConnector(server,ssl,alpn,h2,new HttpConnectionFactory(https_config));
http2Connector.setPort(8443);
server.addConnector(http2Connector);
ALPN.debug=false;
server.start();
server.join();
}
开发者ID:fstab,项目名称:http2-examples,代码行数:45,代码来源:Http2Server.java
示例8: main
import org.eclipse.jetty.alpn.server.ALPNServerConnectionFactory; //导入依赖的package包/类
public static void main(String... args) throws Exception
{
Server server = new Server();
ServletContextHandler context = new ServletContextHandler(server, "/", ServletContextHandler.SESSIONS);
context.addServlet(new ServletHolder(new PushEchoServlet()), "/");
server.setHandler(context);
// HTTP Configuration
HttpConfiguration http_config = new HttpConfiguration();
http_config.setSecureScheme("https");
http_config.setSecurePort(8443);
// SSL Context Factory for HTTPS and HTTP/2
SslContextFactory sslContextFactory = new SslContextFactory();
sslContextFactory.setKeyStoreResource(newClassPathResource("keystore"));
sslContextFactory.setKeyStorePassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4");
sslContextFactory.setKeyManagerPassword("OBF:1u2u1wml1z7s1z7a1wnl1u2g");
sslContextFactory.setCipherComparator(HTTP2Cipher.COMPARATOR);
// HTTPS Configuration
HttpConfiguration https_config = new HttpConfiguration(http_config);
https_config.addCustomizer(new SecureRequestCustomizer());
// HTTP/2 Connection Factory
HTTP2ServerConnectionFactory h2 = new HTTP2ServerConnectionFactory(https_config);
NegotiatingServerConnectionFactory.checkProtocolNegotiationAvailable();
ALPNServerConnectionFactory alpn = new ALPNServerConnectionFactory();
alpn.setDefaultProtocol("h2");
// SSL Connection Factory
SslConnectionFactory ssl = new SslConnectionFactory(sslContextFactory,alpn.getProtocol());
// HTTP/2 Connector
ServerConnector http2Connector =
new ServerConnector(server,ssl,alpn,h2,new HttpConnectionFactory(https_config));
http2Connector.setPort(8443);
server.addConnector(http2Connector);
ALPN.debug=false;
server.start();
server.join();
}
开发者ID:fstab,项目名称:http2-examples,代码行数:46,代码来源:Http2EchoServer.java
示例9: main
import org.eclipse.jetty.alpn.server.ALPNServerConnectionFactory; //导入依赖的package包/类
public static void main(String... args) throws Exception {
Server server = new Server();
ServletContextHandler context = new ServletContextHandler(server, "/", ServletContextHandler.SESSIONS);
context.addServlet(new ServletHolder(new Servlet()), "/");
server.setHandler(context);
// HTTP Configuration
HttpConfiguration http_config = new HttpConfiguration();
http_config.setSecureScheme("https");
http_config.setSecurePort(8443);
// SSL Context Factory for HTTPS and HTTP/2
SslContextFactory sslContextFactory = new SslContextFactory();
sslContextFactory.setKeyStoreResource(newClassPathResource("keystore"));
sslContextFactory.setKeyStorePassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4");
sslContextFactory.setKeyManagerPassword("OBF:1u2u1wml1z7s1z7a1wnl1u2g");
sslContextFactory.setCipherComparator(HTTP2Cipher.COMPARATOR);
// HTTPS Configuration
HttpConfiguration https_config = new HttpConfiguration(http_config);
https_config.addCustomizer(new SecureRequestCustomizer());
// HTTP/2 Connection Factory
HTTP2ServerConnectionFactory h2 = new HTTP2ServerConnectionFactory(https_config);
NegotiatingServerConnectionFactory.checkProtocolNegotiationAvailable();
ALPNServerConnectionFactory alpn = new ALPNServerConnectionFactory();
alpn.setDefaultProtocol("h2");
// SSL Connection Factory
SslConnectionFactory ssl = new SslConnectionFactory(sslContextFactory,alpn.getProtocol());
// HTTP/2 Connector
ServerConnector http2Connector =
new ServerConnector(server,ssl,alpn,h2,new HttpConnectionFactory(https_config));
http2Connector.setPort(8443);
server.addConnector(http2Connector);
ALPN.debug=false;
server.start();
server.join();
}
开发者ID:fstab,项目名称:http2-examples,代码行数:44,代码来源:Http2Server.java
注:本文中的org.eclipse.jetty.alpn.server.ALPNServerConnectionFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论