io.netty.handler.codec.http2.Http2StreamFrameToHttpObjectCodec Java Examples
The following examples show how to use
io.netty.handler.codec.http2.Http2StreamFrameToHttpObjectCodec.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HttpServerConfig.java From reactor-netty with Apache License 2.0 | 6 votes |
static void addStreamHandlers(Channel ch, ChannelOperations.OnSetup opsFactory, ConnectionObserver listener, boolean readForwardHeaders, ServerCookieEncoder encoder, ServerCookieDecoder decoder) { if (ACCESS_LOG) { ch.pipeline() .addLast(NettyPipeline.AccessLogHandler, new AccessLogHandlerH2()); } ch.pipeline() .addLast(NettyPipeline.H2ToHttp11Codec, new Http2StreamFrameToHttpObjectCodec(true)) .addLast(NettyPipeline.HttpTrafficHandler, new Http2StreamBridgeServerHandler(listener, readForwardHeaders, encoder, decoder)); ChannelOperations.addReactiveBridge(ch, opsFactory, listener); if (log.isDebugEnabled()) { log.debug(format(ch, "Initialized HTTP/2 stream pipeline {}"), ch.pipeline()); } }
Example #2
Source File: Http2NetworkClient.java From ambry with Apache License 2.0 | 6 votes |
public Http2NetworkClient(Http2ClientMetrics http2ClientMetrics, Http2ClientConfig http2ClientConfig, SSLFactory sslFactory) { logger.info("Http2NetworkClient started"); this.http2ClientConfig = http2ClientConfig; if (Epoll.isAvailable()) { logger.info("Using EpollEventLoopGroup in Http2NetworkClient."); this.eventLoopGroup = new EpollEventLoopGroup(http2ClientConfig.http2NettyEventLoopGroupThreads); } else { this.eventLoopGroup = new NioEventLoopGroup(http2ClientConfig.http2NettyEventLoopGroupThreads); } this.http2ClientResponseHandler = new Http2ClientResponseHandler(http2ClientMetrics); this.http2ClientStreamStatsHandler = new Http2ClientStreamStatsHandler(http2ClientMetrics); this.http2StreamFrameToHttpObjectCodec = new Http2StreamFrameToHttpObjectCodec(false); this.ambrySendToHttp2Adaptor = new AmbrySendToHttp2Adaptor(false); this.pools = new Http2ChannelPoolMap(sslFactory, eventLoopGroup, http2ClientConfig, http2ClientMetrics, new StreamChannelInitializer()); this.http2ClientMetrics = http2ClientMetrics; }
Example #3
Source File: StorageServerNettyFactory.java From ambry with Apache License 2.0 | 6 votes |
/** * Creates a new instance of StorageServerNettyFactory. * @param http2Port the port for HTTP2 request. * @param requestResponseChannel the {@link RequestResponseChannel} to receive original ambry request and send * original ambry response. * @param sslFactory the {@link SSLFactory} used to construct the {@link javax.net.ssl.SSLEngine} used for * handling http2 requests. * @param nettyConfig the nettyConfig * @param http2ClientConfig the http2ClientConfig * @param serverMetrics the serverMetrics * @param nettyMetrics the nettyMetrics * @param http2ServerMetrics the http2ServerMetrics * @param serverSecurityService the serverSecurityService used to create ServerSecurityHandler * @throws IllegalArgumentException if any of the arguments are null. */ public StorageServerNettyFactory(int http2Port, RequestResponseChannel requestResponseChannel, SSLFactory sslFactory, NettyConfig nettyConfig, Http2ClientConfig http2ClientConfig, ServerMetrics serverMetrics, NettyMetrics nettyMetrics, Http2ServerMetrics http2ServerMetrics, ServerSecurityService serverSecurityService) { if (requestResponseChannel == null || sslFactory == null || nettyConfig == null || http2ClientConfig == null || serverMetrics == null || nettyMetrics == null || http2ServerMetrics == null || serverSecurityService == null) { throw new IllegalArgumentException("Null arg(s) received during instantiation of StorageServerNettyFactory"); } this.nettyConfig = nettyConfig; this.nettyMetrics = nettyMetrics; // For ServerSecurityHandler, Http2ServerStreamHandler, AmbryNetworkRequestHandler, // Http2StreamFrameToHttpObjectCodec and AmbrySendToHttp2Adaptor, each of them should only have one instance. ServerSecurityHandler serverSecurityHandler = new ServerSecurityHandler(serverSecurityService, serverMetrics); Http2ServerStreamHandler http2ServerStreamHandler = new Http2ServerStreamHandler(new AmbryNetworkRequestHandler(requestResponseChannel, http2ServerMetrics), new Http2StreamFrameToHttpObjectCodec(true), new AmbrySendToHttp2Adaptor(true), http2ClientConfig); ConnectionStatsHandler connectionStatsHandler = new ConnectionStatsHandler(nettyMetrics); Map<Integer, ChannelInitializer<SocketChannel>> initializers = Collections.singletonMap(http2Port, new StorageServerNettyChannelInitializer(http2ClientConfig, http2ServerMetrics, sslFactory, connectionStatsHandler, http2ServerStreamHandler, serverSecurityHandler)); channelInitializers = Collections.unmodifiableMap(initializers); }
Example #4
Source File: HttpClientConfig.java From reactor-netty with Apache License 2.0 | 5 votes |
static void addStreamHandlers(Channel ch, ConnectionObserver obs, ChannelOperations.OnSetup opsFactory) { ch.pipeline() .addLast(NettyPipeline.H2ToHttp11Codec, new Http2StreamFrameToHttpObjectCodec(false)) .addLast(NettyPipeline.HttpTrafficHandler, new Http2StreamBridgeClientHandler(obs, opsFactory)); ChannelOperations.addReactiveBridge(ch, opsFactory, obs); if (log.isDebugEnabled()) { log.debug(format(ch, "Initialized HTTP/2 stream pipeline {}"), ch.pipeline()); } }
Example #5
Source File: Http2ServerStreamHandler.java From ambry with Apache License 2.0 | 5 votes |
public Http2ServerStreamHandler(AmbryNetworkRequestHandler ambryNetworkRequestHandler, Http2StreamFrameToHttpObjectCodec http2StreamFrameToHttpObjectCodec, AmbrySendToHttp2Adaptor ambrySendToHttp2Adaptor, Http2ClientConfig http2ClientConfig) { this.http2StreamFrameToHttpObjectCodec = http2StreamFrameToHttpObjectCodec; this.ambryNetworkRequestHandler = ambryNetworkRequestHandler; this.ambrySendToHttp2Adaptor = ambrySendToHttp2Adaptor; this.http2ClientConfig = http2ClientConfig; }
Example #6
Source File: Http2StreamInitializer.java From zuul with Apache License 2.0 | 5 votes |
protected void addHttp2StreamSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("h2_metrics_inbound", http2MetricsChannelHandlers.inbound()); pipeline.addLast("h2_metrics_outbound", http2MetricsChannelHandlers.outbound()); pipeline.addLast("h2_max_requests_per_conn", connectionExpiryHandler); pipeline.addLast("h2_conn_close", connectionCloseHandler); pipeline.addLast(http2ResetFrameHandler); pipeline.addLast("h2_downgrader", new Http2StreamFrameToHttpObjectCodec(true)); pipeline.addLast(http2StreamErrorHandler); pipeline.addLast(http2StreamHeaderCleaner); }