public HttpClientPipelineFactory(NettyConnectionPool nettyConnectionPool, Timer timer, OrderedMemoryAwareThreadPoolExecutor executor, Duration readTimeout, DataSize maxContentLength) { this.timer = timer; Preconditions.checkNotNull(nettyConnectionPool, "nettyConnectionPool is null"); Preconditions.checkNotNull(executor, "executor is null"); Preconditions.checkNotNull(readTimeout, "readTimeout is null"); Preconditions.checkNotNull(maxContentLength, "maxContentLength is null"); this.nettyConnectionPool = nettyConnectionPool; this.executor = executor; this.timeoutHandler = new ReadTimeoutHandler(this.timer, (long) readTimeout.toMillis(), TimeUnit.MILLISECONDS); this.maxContentLength = Ints.checkedCast(maxContentLength.toBytes()); }
connectionFactories.add(new ALPNServerConnectionFactory("h2", "http/1.1")); HTTP2ServerConnectionFactory http2 = new HTTP2ServerConnectionFactory(configuration); http2.setInitialSessionRecvWindow(toIntExact(config.getHttp2InitialSessionReceiveWindowSize().toBytes())); http2.setInitialStreamRecvWindow(toIntExact(config.getHttp2InitialStreamReceiveWindowSize().toBytes())); http2.setMaxConcurrentStreams(config.getHttp2MaxConcurrentStreams()); http2.setInputBufferSize(toIntExact(config.getHttp2InputBufferSize().toBytes())); http2.setStreamIdleTimeout(config.getHttp2StreamIdleTimeout().toMillis()); connectionFactories.add(http2);
baseHttpConfiguration.setSendXPoweredBy(false); if (config.getMaxRequestHeaderSize() != null) { baseHttpConfiguration.setRequestHeaderSize(toIntExact(config.getMaxRequestHeaderSize().toBytes())); HttpConnectionFactory http1 = new HttpConnectionFactory(httpConfiguration); HTTP2CServerConnectionFactory http2c = new HTTP2CServerConnectionFactory(httpConfiguration); http2c.setInitialSessionRecvWindow(toIntExact(config.getHttp2InitialSessionReceiveWindowSize().toBytes())); http2c.setInitialStreamRecvWindow(toIntExact(config.getHttp2InitialStreamReceiveWindowSize().toBytes())); http2c.setMaxConcurrentStreams(config.getHttp2MaxConcurrentStreams()); http2c.setInputBufferSize(toIntExact(config.getHttp2InputBufferSize().toBytes())); http2c.setStreamIdleTimeout(config.getHttp2StreamIdleTimeout().toMillis()); httpConnector = createServerConnector(
requireNonNull(requestFilters, "requestFilters is null"); maxContentLength = config.getMaxContentLength().toBytes(); Duration requestTimeout = config.getRequestTimeout(); if (requestTimeout == null) { if (config.isHttp2Enabled()) { HTTP2Client client = new HTTP2Client(); client.setInitialSessionRecvWindow(toIntExact(config.getHttp2InitialSessionReceiveWindowSize().toBytes())); client.setInitialStreamRecvWindow(toIntExact(config.getHttp2InitialStreamReceiveWindowSize().toBytes())); client.setInputBufferSize(toIntExact(config.getHttp2InputBufferSize().toBytes())); client.setSelectors(config.getSelectorCount()); transport = new HttpClientTransportOverHTTP2(client); httpClient.setRequestBufferSize(toIntExact(config.getRequestBufferSize().toBytes())); httpClient.setResponseBufferSize(toIntExact(config.getResponseBufferSize().toBytes()));