Home / Class/ Http2OrHttpHandler Class — netty Architecture

Http2OrHttpHandler Class — netty Architecture

Architecture documentation for the Http2OrHttpHandler class in Http2OrHttpHandler.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  45a08598_7a55_ec18_f1b2_9a34857037ed["Http2OrHttpHandler"]
  d364d489_cae4_0706_0e3e_be57dbe3297b["Http2OrHttpHandler.java"]
  45a08598_7a55_ec18_f1b2_9a34857037ed -->|defined in| d364d489_cae4_0706_0e3e_be57dbe3297b
  299917bc_07bc_dae7_3678_fc51ad84275d["Http2OrHttpHandler()"]
  45a08598_7a55_ec18_f1b2_9a34857037ed -->|method| 299917bc_07bc_dae7_3678_fc51ad84275d
  fc0e155e_43e8_8b34_fbe6_afd54b334418["configurePipeline()"]
  45a08598_7a55_ec18_f1b2_9a34857037ed -->|method| fc0e155e_43e8_8b34_fbe6_afd54b334418

Relationship Graph

Source Code

example/src/main/java/io/netty/example/http2/helloworld/frame/server/Http2OrHttpHandler.java lines 29–53

public class Http2OrHttpHandler extends ApplicationProtocolNegotiationHandler {

    private static final int MAX_CONTENT_LENGTH = 1024 * 100;

    protected Http2OrHttpHandler() {
        super(ApplicationProtocolNames.HTTP_1_1);
    }

    @Override
    protected void configurePipeline(ChannelHandlerContext ctx, String protocol) throws Exception {
        if (ApplicationProtocolNames.HTTP_2.equals(protocol)) {
            ctx.pipeline().addLast(Http2FrameCodecBuilder.forServer().build(), new HelloWorldHttp2Handler());
            return;
        }

        if (ApplicationProtocolNames.HTTP_1_1.equals(protocol)) {
            ctx.pipeline().addLast(new HttpServerCodec(),
                                   new HttpObjectAggregator(MAX_CONTENT_LENGTH),
                                   new HelloWorldHttp1Handler("ALPN Negotiation"));
            return;
        }

        throw new IllegalStateException("unknown protocol: " + protocol);
    }
}

Frequently Asked Questions

What is the Http2OrHttpHandler class?
Http2OrHttpHandler is a class in the netty codebase, defined in example/src/main/java/io/netty/example/http2/helloworld/frame/server/Http2OrHttpHandler.java.
Where is Http2OrHttpHandler defined?
Http2OrHttpHandler is defined in example/src/main/java/io/netty/example/http2/helloworld/frame/server/Http2OrHttpHandler.java at line 29.

Analyze Your Own Codebase

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

Try Supermodel Free