Home / Class/ UpgradeRequestHandler Class — netty Architecture

UpgradeRequestHandler Class — netty Architecture

Architecture documentation for the UpgradeRequestHandler class in Http2ClientInitializer.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  45bf358e_4b59_567e_32e7_9aa742ced8d1["UpgradeRequestHandler"]
  3207617e_a09d_a13b_e65a_89274792f09a["Http2ClientInitializer.java"]
  45bf358e_4b59_567e_32e7_9aa742ced8d1 -->|defined in| 3207617e_a09d_a13b_e65a_89274792f09a
  9b928122_a110_e79c_20a3_15a81f4ac129["channelActive()"]
  45bf358e_4b59_567e_32e7_9aa742ced8d1 -->|method| 9b928122_a110_e79c_20a3_15a81f4ac129

Relationship Graph

Source Code

example/src/main/java/io/netty/example/http2/helloworld/client/Http2ClientInitializer.java lines 139–163

    private final class UpgradeRequestHandler extends ChannelInboundHandlerAdapter {

        @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());
        }
    }

Frequently Asked Questions

What is the UpgradeRequestHandler class?
UpgradeRequestHandler is a class in the netty codebase, defined in example/src/main/java/io/netty/example/http2/helloworld/client/Http2ClientInitializer.java.
Where is UpgradeRequestHandler defined?
UpgradeRequestHandler is defined in example/src/main/java/io/netty/example/http2/helloworld/client/Http2ClientInitializer.java at line 139.

Analyze Your Own Codebase

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

Try Supermodel Free