Home / Function/ channelActive() — netty Function Reference

channelActive() — netty Function Reference

Architecture documentation for the channelActive() function in Http2ClientInitializer.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  9b928122_a110_e79c_20a3_15a81f4ac129["channelActive()"]
  45bf358e_4b59_567e_32e7_9aa742ced8d1["UpgradeRequestHandler"]
  9b928122_a110_e79c_20a3_15a81f4ac129 -->|defined in| 45bf358e_4b59_567e_32e7_9aa742ced8d1
  4804e25a_c676_6daf_89ce_d3dd191d19e7["configureEndOfPipeline()"]
  9b928122_a110_e79c_20a3_15a81f4ac129 -->|calls| 4804e25a_c676_6daf_89ce_d3dd191d19e7
  style 9b928122_a110_e79c_20a3_15a81f4ac129 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

example/src/main/java/io/netty/example/http2/helloworld/client/Http2ClientInitializer.java lines 141–162

        @Override
        public void channelActive(ChannelHandlerContext ctx) throws Exception {
            DefaultFullHttpRequest upgradeRequest =
                    new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, "/", Unpooled.EMPTY_BUFFER);

            // Set HOST header as the remote peer may require it.
            InetSocketAddress remote = (InetSocketAddress) ctx.channel().remoteAddress();
            String hostString = remote.getHostString();
            if (hostString == null) {
                hostString = remote.getAddress().getHostAddress();
            }
            upgradeRequest.headers().set(HttpHeaderNames.HOST, hostString + ':' + remote.getPort());

            ctx.writeAndFlush(upgradeRequest);

            ctx.fireChannelActive();

            // Done with this handler, remove it from the pipeline.
            ctx.pipeline().remove(this);

            configureEndOfPipeline(ctx.pipeline());
        }

Domain

Subdomains

Frequently Asked Questions

What does channelActive() do?
channelActive() is a function in the netty codebase, defined in example/src/main/java/io/netty/example/http2/helloworld/client/Http2ClientInitializer.java.
Where is channelActive() defined?
channelActive() is defined in example/src/main/java/io/netty/example/http2/helloworld/client/Http2ClientInitializer.java at line 141.
What does channelActive() call?
channelActive() calls 1 function(s): configureEndOfPipeline.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free