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
  2ab52776_9594_5ba6_58ae_344d65880d33["Http2OrHttpHandler"]
  feea4492_e4a4_cef3_db75_07aa6e7aa7a6["Http2OrHttpHandler.java"]
  2ab52776_9594_5ba6_58ae_344d65880d33 -->|defined in| feea4492_e4a4_cef3_db75_07aa6e7aa7a6
  dcf29a2b_0e34_2f57_8c0e_ee89e49d332b["Http2OrHttpHandler()"]
  2ab52776_9594_5ba6_58ae_344d65880d33 -->|method| dcf29a2b_0e34_2f57_8c0e_ee89e49d332b
  1f83c653_5838_6533_87a9_2fff834f605f["configurePipeline()"]
  2ab52776_9594_5ba6_58ae_344d65880d33 -->|method| 1f83c653_5838_6533_87a9_2fff834f605f

Relationship Graph

Source Code

example/src/main/java/io/netty/example/http2/helloworld/multiplex/server/Http2OrHttpHandler.java lines 30–55

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());
            ctx.pipeline().addLast(new Http2MultiplexHandler(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/multiplex/server/Http2OrHttpHandler.java.
Where is Http2OrHttpHandler defined?
Http2OrHttpHandler is defined in example/src/main/java/io/netty/example/http2/helloworld/multiplex/server/Http2OrHttpHandler.java at line 30.

Analyze Your Own Codebase

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

Try Supermodel Free