Home / Class/ HttpServer Class — netty Architecture

HttpServer Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  b5adda21_162a_b7dd_9c2d_3d63f677a52f["HttpServer"]
  cc8bbee1_dbe4_b604_51dd_d387a19dd70e["HttpServer.java"]
  b5adda21_162a_b7dd_9c2d_3d63f677a52f -->|defined in| cc8bbee1_dbe4_b604_51dd_d387a19dd70e
  c3e6fc64_3173_750e_6426_77a33b11d100["HttpServer()"]
  b5adda21_162a_b7dd_9c2d_3d63f677a52f -->|method| c3e6fc64_3173_750e_6426_77a33b11d100
  f931d1ec_9bc8_8e3a_7a8e_7506887d428d["ChannelFuture()"]
  b5adda21_162a_b7dd_9c2d_3d63f677a52f -->|method| f931d1ec_9bc8_8e3a_7a8e_7506887d428d

Relationship Graph

Source Code

example/src/main/java/io/netty/example/http2/tiles/HttpServer.java lines 37–66

public final class HttpServer {

    public static final int PORT = Integer.parseInt(System.getProperty("http-port", "8080"));
    private static final int MAX_CONTENT_LENGTH = 1024 * 100;

    private final EventLoopGroup group;

    public HttpServer(EventLoopGroup eventLoopGroup) {
        group = eventLoopGroup;
    }

    public ChannelFuture start() throws Exception {
        ServerBootstrap b = new ServerBootstrap();
        b.option(ChannelOption.SO_BACKLOG, 1024);

        b.group(group).channel(NioServerSocketChannel.class).handler(new LoggingHandler(LogLevel.INFO))
        .childHandler(new ChannelInitializer<SocketChannel>() {
            @Override
            protected void initChannel(SocketChannel ch) throws Exception {
                ch.pipeline().addLast(new HttpRequestDecoder(),
                                      new HttpResponseEncoder(),
                                      new HttpObjectAggregator(MAX_CONTENT_LENGTH),
                                      new Http1RequestHandler());
            }
        });

        Channel ch = b.bind(PORT).sync().channel();
        return ch.closeFuture();
    }
}

Frequently Asked Questions

What is the HttpServer class?
HttpServer is a class in the netty codebase, defined in example/src/main/java/io/netty/example/http2/tiles/HttpServer.java.
Where is HttpServer defined?
HttpServer is defined in example/src/main/java/io/netty/example/http2/tiles/HttpServer.java at line 37.

Analyze Your Own Codebase

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

Try Supermodel Free