use of org.eclipse.jetty.http2.server.HTTP2CServerConnectionFactory in project spring-boot by spring-projects.
the class JettyServletWebServerFactory method createConnector.
private AbstractConnector createConnector(InetSocketAddress address, Server server) {
HttpConfiguration httpConfiguration = new HttpConfiguration();
httpConfiguration.setSendServerVersion(false);
List<ConnectionFactory> connectionFactories = new ArrayList<>();
connectionFactories.add(new HttpConnectionFactory(httpConfiguration));
if (getHttp2() != null && getHttp2().isEnabled()) {
connectionFactories.add(new HTTP2CServerConnectionFactory(httpConfiguration));
}
ServerConnector connector = new ServerConnector(server, this.acceptors, this.selectors, connectionFactories.toArray(new ConnectionFactory[0]));
connector.setHost(address.getHostString());
connector.setPort(address.getPort());
return connector;
}
use of org.eclipse.jetty.http2.server.HTTP2CServerConnectionFactory in project spring-boot by spring-projects.
the class JettyReactiveWebServerFactory method createConnector.
private AbstractConnector createConnector(InetSocketAddress address, Server server) {
HttpConfiguration httpConfiguration = new HttpConfiguration();
httpConfiguration.setSendServerVersion(false);
List<ConnectionFactory> connectionFactories = new ArrayList<>();
connectionFactories.add(new HttpConnectionFactory(httpConfiguration));
if (getHttp2() != null && getHttp2().isEnabled()) {
connectionFactories.add(new HTTP2CServerConnectionFactory(httpConfiguration));
}
JettyResourceFactory resourceFactory = getResourceFactory();
ServerConnector connector;
if (resourceFactory != null) {
connector = new ServerConnector(server, resourceFactory.getExecutor(), resourceFactory.getScheduler(), resourceFactory.getByteBufferPool(), this.acceptors, this.selectors, connectionFactories.toArray(new ConnectionFactory[0]));
} else {
connector = new ServerConnector(server, this.acceptors, this.selectors, connectionFactories.toArray(new ConnectionFactory[0]));
}
connector.setHost(address.getHostString());
connector.setPort(address.getPort());
return connector;
}
use of org.eclipse.jetty.http2.server.HTTP2CServerConnectionFactory in project cxf by apache.
the class JettyHTTPServerEngine method createConnectorJetty.
AbstractConnector createConnectorJetty(SslContextFactory sslcf, String hosto, int porto, int major, int minor, final Bus bus) {
final AbstractConnector result;
try {
HttpConfiguration httpConfig = new HttpConfiguration();
httpConfig.setSendServerVersion(getSendServerVersion());
HttpConnectionFactory httpFactory = new HttpConnectionFactory(httpConfig);
Collection<ConnectionFactory> connectionFactories = new ArrayList<>();
result = new org.eclipse.jetty.server.ServerConnector(server);
if (tlsServerParameters != null) {
httpConfig.addCustomizer(new org.eclipse.jetty.server.SecureRequestCustomizer());
if (!isHttp2Enabled(bus)) {
final SslConnectionFactory scf = new SslConnectionFactory(sslcf, httpFactory.getProtocol());
connectionFactories.add(scf);
} else {
// The ALPN processors are application specific (as per Jetty docs) and are pluggable as
// additional dependency.
final ALPNServerConnectionFactory alpn = new ALPNServerConnectionFactory();
alpn.setDefaultProtocol(httpFactory.getProtocol());
final SslConnectionFactory scf = new SslConnectionFactory(sslcf, alpn.getProtocol());
connectionFactories.add(scf);
connectionFactories.add(alpn);
connectionFactories.add(new HTTP2ServerConnectionFactory(httpConfig));
}
String proto = (major > 9 || (major == 9 && minor >= 3)) ? "SSL" : "SSL-HTTP/1.1";
result.setDefaultProtocol(proto);
} else if (isHttp2Enabled(bus)) {
connectionFactories.add(new HTTP2CServerConnectionFactory(httpConfig));
}
connectionFactories.add(httpFactory);
result.setConnectionFactories(connectionFactories);
if (getMaxIdleTime() > 0) {
result.setIdleTimeout(Long.valueOf(getMaxIdleTime()));
}
} catch (RuntimeException rex) {
throw rex;
} catch (Exception ex) {
throw new RuntimeException(ex);
}
return result;
}
Aggregations