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
  d89cf5e8_dd84_6aa4_a07e_baeb8aefa500["Http2OrHttpHandler"]
  0b946ec4_d82b_703a_85bd_c8526c99be71["Http2OrHttpHandler.java"]
  d89cf5e8_dd84_6aa4_a07e_baeb8aefa500 -->|defined in| 0b946ec4_d82b_703a_85bd_c8526c99be71
  1bf1b7f7_e2cd_cfe1_5fe8_7b12cb12aede["Http2OrHttpHandler()"]
  d89cf5e8_dd84_6aa4_a07e_baeb8aefa500 -->|method| 1bf1b7f7_e2cd_cfe1_5fe8_7b12cb12aede
  c00bf55e_2c26_99e5_1795_0c6358b2ca67["configurePipeline()"]
  d89cf5e8_dd84_6aa4_a07e_baeb8aefa500 -->|method| c00bf55e_2c26_99e5_1795_0c6358b2ca67

Relationship Graph

Source Code

example/src/main/java/io/netty/example/http2/helloworld/server/Http2OrHttpHandler.java lines 27–51

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(new HelloWorldHttp2HandlerBuilder().build());
            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/server/Http2OrHttpHandler.java.
Where is Http2OrHttpHandler defined?
Http2OrHttpHandler is defined in example/src/main/java/io/netty/example/http2/helloworld/server/Http2OrHttpHandler.java at line 27.

Analyze Your Own Codebase

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

Try Supermodel Free