@Override public Connector build(Server server, MetricRegistry metrics, String name, @Nullable ThreadPool threadPool) { final HttpConfiguration httpConfig = buildHttpConfiguration(); final HttpConnectionFactory httpConnectionFactory = buildHttpConnectionFactory(httpConfig); final Scheduler scheduler = new ScheduledExecutorScheduler(); final ByteBufferPool bufferPool = buildBufferPool(); return buildConnector(server, scheduler, bufferPool, name, threadPool, new Jetty93InstrumentedConnectionFactory(httpConnectionFactory, metrics.timer(httpConnections()))); }
public Jetty93InstrumentedConnectionFactory(ConnectionFactory connectionFactory, Timer timer) { this.connectionFactory = connectionFactory; this.timer = timer; addBean(connectionFactory); }
@Override public Connector build(Server server, MetricRegistry metrics, String name, @Nullable ThreadPool threadPool) { // Prepare connection factories for HTTP/2c final HttpConfiguration httpConfig = buildHttpConfiguration(); final HttpConnectionFactory http11 = buildHttpConnectionFactory(httpConfig); final HTTP2ServerConnectionFactory http2c = new HTTP2CServerConnectionFactory(httpConfig); http2c.setMaxConcurrentStreams(maxConcurrentStreams); http2c.setInitialStreamRecvWindow(initialStreamRecvWindow); // The server connector should use HTTP/1.1 by default. It affords to the server to stay compatible // with old clients. New clients which want to use HTTP/2, however, will make an HTTP/1.1 OPTIONS // request with an Upgrade header with "h2c" value. The server supports HTTP/2 clear text connections, // so it will return the predefined HTTP/2 preamble and the client and the server will switch to the // new protocol. return buildConnector(server, new ScheduledExecutorScheduler(), buildBufferPool(), name, threadPool, new Jetty93InstrumentedConnectionFactory(http11, metrics.timer(httpConnections())), http2c); } }
public Jetty93InstrumentedConnectionFactory(ConnectionFactory connectionFactory, Timer timer) { this.connectionFactory = connectionFactory; this.timer = timer; addBean(connectionFactory); }
@Override public Connector build(Server server, MetricRegistry metrics, String name, @Nullable ThreadPool threadPool) { final HttpConfiguration httpConfig = buildHttpConfiguration(); final HttpConnectionFactory httpConnectionFactory = buildHttpConnectionFactory(httpConfig); final SslContextFactory sslContextFactory = configureSslContextFactory(new SslContextFactory()); sslContextFactory.addLifeCycleListener(logSslInfoOnStart(sslContextFactory)); server.addBean(sslContextFactory); server.addBean(new SslReload(sslContextFactory, this::configureSslContextFactory)); final SslConnectionFactory sslConnectionFactory = new SslConnectionFactory(sslContextFactory, HttpVersion.HTTP_1_1.toString()); final Scheduler scheduler = new ScheduledExecutorScheduler(); final ByteBufferPool bufferPool = buildBufferPool(); return buildConnector(server, scheduler, bufferPool, name, threadPool, new Jetty93InstrumentedConnectionFactory( sslConnectionFactory, metrics.timer(httpConnections())), httpConnectionFactory); }
@Override public Connector build(Server server, MetricRegistry metrics, String name, @Nullable ThreadPool threadPool) { // HTTP/2 requires that a server MUST support TLSv1.2 and TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 cipher // See http://http2.github.io/http2-spec/index.html#rfc.section.9.2.2 setSupportedProtocols(Collections.singletonList("TLSv1.2")); checkSupportedCipherSuites(); // Setup connection factories final HttpConfiguration httpConfig = buildHttpConfiguration(); final HttpConnectionFactory http1 = buildHttpConnectionFactory(httpConfig); final HTTP2ServerConnectionFactory http2 = new HTTP2ServerConnectionFactory(httpConfig); http2.setMaxConcurrentStreams(maxConcurrentStreams); http2.setInitialStreamRecvWindow(initialStreamRecvWindow); final NegotiatingServerConnectionFactory alpn = new ALPNServerConnectionFactory(H2, H2_17); alpn.setDefaultProtocol(HTTP_1_1); // Speak HTTP 1.1 over TLS if negotiation fails final SslContextFactory sslContextFactory = configureSslContextFactory(new SslContextFactory()); sslContextFactory.addLifeCycleListener(logSslInfoOnStart(sslContextFactory)); server.addBean(sslContextFactory); server.addBean(new SslReload(sslContextFactory, this::configureSslContextFactory)); // We should use ALPN as a negotiation protocol. Old clients that don't support it will be served // via HTTPS. New clients, however, that want to use HTTP/2 will use TLS with ALPN extension. // If negotiation succeeds, the client and server switch to HTTP/2 protocol. final SslConnectionFactory sslConnectionFactory = new SslConnectionFactory(sslContextFactory, "alpn"); return buildConnector(server, new ScheduledExecutorScheduler(), buildBufferPool(), name, threadPool, new Jetty93InstrumentedConnectionFactory(sslConnectionFactory, metrics.timer(httpConnections())), alpn, http2, http1); }
@Override public Connector build(Server server, MetricRegistry metrics, String name, @Nullable ThreadPool threadPool) { final HttpConfiguration httpConfig = buildHttpConfiguration(); final HttpConnectionFactory httpConnectionFactory = buildHttpConnectionFactory(httpConfig); final Scheduler scheduler = new ScheduledExecutorScheduler(); final ByteBufferPool bufferPool = buildBufferPool(); return buildConnector(server, scheduler, bufferPool, name, threadPool, new Jetty93InstrumentedConnectionFactory(httpConnectionFactory, metrics.timer(httpConnections()))); }
@Override public Connector build(Server server, MetricRegistry metrics, String name, @Nullable ThreadPool threadPool) { // Prepare connection factories for HTTP/2c final HttpConfiguration httpConfig = buildHttpConfiguration(); final HttpConnectionFactory http11 = buildHttpConnectionFactory(httpConfig); final HTTP2ServerConnectionFactory http2c = new HTTP2CServerConnectionFactory(httpConfig); http2c.setMaxConcurrentStreams(maxConcurrentStreams); http2c.setInitialStreamRecvWindow(initialStreamRecvWindow); // The server connector should use HTTP/1.1 by default. It affords to the server to stay compatible // with old clients. New clients which want to use HTTP/2, however, will make an HTTP/1.1 OPTIONS // request with an Upgrade header with "h2c" value. The server supports HTTP/2 clear text connections, // so it will return the predefined HTTP/2 preamble and the client and the server will switch to the // new protocol. return buildConnector(server, new ScheduledExecutorScheduler(), buildBufferPool(), name, threadPool, new Jetty93InstrumentedConnectionFactory(http11, metrics.timer(httpConnections())), http2c); } }
@Override public Connector build(Server server, MetricRegistry metrics, String name, @Nullable ThreadPool threadPool) { final HttpConfiguration httpConfig = buildHttpConfiguration(); final HttpConnectionFactory httpConnectionFactory = buildHttpConnectionFactory(httpConfig); final SslContextFactory sslContextFactory = configureSslContextFactory(new SslContextFactory()); sslContextFactory.addLifeCycleListener(logSslInfoOnStart(sslContextFactory)); server.addBean(sslContextFactory); server.addBean(new SslReload(sslContextFactory, this::configureSslContextFactory)); final SslConnectionFactory sslConnectionFactory = new SslConnectionFactory(sslContextFactory, HttpVersion.HTTP_1_1.toString()); final Scheduler scheduler = new ScheduledExecutorScheduler(); final ByteBufferPool bufferPool = buildBufferPool(); return buildConnector(server, scheduler, bufferPool, name, threadPool, new Jetty93InstrumentedConnectionFactory( sslConnectionFactory, metrics.timer(httpConnections())), httpConnectionFactory); }
@Override public Connector build(Server server, MetricRegistry metrics, String name, @Nullable ThreadPool threadPool) { // HTTP/2 requires that a server MUST support TLSv1.2 and TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 cipher // See http://http2.github.io/http2-spec/index.html#rfc.section.9.2.2 setSupportedProtocols(ImmutableList.of("TLSv1.2")); checkSupportedCipherSuites(); // Setup connection factories final HttpConfiguration httpConfig = buildHttpConfiguration(); final HttpConnectionFactory http1 = buildHttpConnectionFactory(httpConfig); final HTTP2ServerConnectionFactory http2 = new HTTP2ServerConnectionFactory(httpConfig); http2.setMaxConcurrentStreams(maxConcurrentStreams); http2.setInitialStreamRecvWindow(initialStreamRecvWindow); final NegotiatingServerConnectionFactory alpn = new ALPNServerConnectionFactory(H2, H2_17); alpn.setDefaultProtocol(HTTP_1_1); // Speak HTTP 1.1 over TLS if negotiation fails final SslContextFactory sslContextFactory = configureSslContextFactory(new SslContextFactory()); sslContextFactory.addLifeCycleListener(logSslInfoOnStart(sslContextFactory)); server.addBean(sslContextFactory); server.addBean(new SslReload(sslContextFactory, this::configureSslContextFactory)); // We should use ALPN as a negotiation protocol. Old clients that don't support it will be served // via HTTPS. New clients, however, that want to use HTTP/2 will use TLS with ALPN extension. // If negotiation succeeds, the client and server switch to HTTP/2 protocol. final SslConnectionFactory sslConnectionFactory = new SslConnectionFactory(sslContextFactory, "alpn"); return buildConnector(server, new ScheduledExecutorScheduler(), buildBufferPool(), name, threadPool, new Jetty93InstrumentedConnectionFactory(sslConnectionFactory, metrics.timer(httpConnections())), alpn, http2, http1); }