private ServerConnector createServerConnector(Server server, SslContextFactory sslContextFactory, HttpConfiguration config) { if (this.http2 == null || !this.http2.isEnabled()) { return createHttp11ServerConnector(server, config, sslContextFactory); } Assert.state(isAlpnPresent(), () -> "The 'org.eclipse.jetty:jetty-alpn-server' " + "dependency is required for HTTP/2 support."); Assert.state(isConscryptPresent(), () -> "The 'org.eclipse.jetty.http2:http2-server' and Conscrypt " + "dependencies are required for HTTP/2 support."); return createHttp2ServerConnector(server, config, sslContextFactory); }
@Override public HttpServer apply(HttpServer server) { try { return server.secure((contextSpec) -> { SslProvider.DefaultConfigurationSpec spec = contextSpec .sslContext(getContextBuilder()); if (this.http2 != null && this.http2.isEnabled()) { spec.defaultConfiguration(SslProvider.DefaultConfigurationType.H2); } }); } catch (Exception ex) { throw new IllegalStateException(ex); } }
private HttpProtocol[] listProtocols() { if (getHttp2() != null && getHttp2().isEnabled()) { if (getSsl() != null && getSsl().isEnabled()) { return new HttpProtocol[] { HttpProtocol.H2, HttpProtocol.HTTP11 }; } else { return new HttpProtocol[] { HttpProtocol.H2C, HttpProtocol.HTTP11 }; } } return new HttpProtocol[] { HttpProtocol.HTTP11 }; }
private void customizeSsl(Connector connector) { new SslConnectorCustomizer(getSsl(), getSslStoreProvider()).customize(connector); if (getHttp2() != null && getHttp2().isEnabled()) { connector.addUpgradeProtocol(new Http2Protocol()); } }
private void customizeSsl(Connector connector) { new SslConnectorCustomizer(getSsl(), getSslStoreProvider()).customize(connector); if (getHttp2() != null && getHttp2().isEnabled()) { connector.addUpgradeProtocol(new Http2Protocol()); } }
private void customizeSsl(Undertow.Builder builder) { new SslBuilderCustomizer(getPort(), getAddress(), getSsl(), getSslStoreProvider()) .customize(builder); if (getHttp2() != null) { builder.setServerOption(UndertowOptions.ENABLE_HTTP2, getHttp2().isEnabled()); } }
private void customizeSsl(Builder builder) { new SslBuilderCustomizer(getPort(), getAddress(), getSsl(), getSslStoreProvider()) .customize(builder); if (getHttp2() != null) { builder.setServerOption(UndertowOptions.ENABLE_HTTP2, getHttp2().isEnabled()); } }
if (http2 != null && !http2.isEnabled()) { logger.warn( "Cannot disable HTTP/2 protocol for Armeria server. It will be enabled automatically.");