Home / Class/ HttpCorsServerInitializer Class — netty Architecture

HttpCorsServerInitializer Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  1cbf5cd6_d2c2_23a9_f038_bac977e4f1f2["HttpCorsServerInitializer"]
  4e9608c0_d69d_aa16_fd57_238600baac0d["HttpCorsServerInitializer.java"]
  1cbf5cd6_d2c2_23a9_f038_bac977e4f1f2 -->|defined in| 4e9608c0_d69d_aa16_fd57_238600baac0d
  9496d1fa_b83b_3202_8259_4bd5017d0ce0["HttpCorsServerInitializer()"]
  1cbf5cd6_d2c2_23a9_f038_bac977e4f1f2 -->|method| 9496d1fa_b83b_3202_8259_4bd5017d0ce0
  1d26cfc5_0ba4_d279_b820_08e5c8173506["initChannel()"]
  1cbf5cd6_d2c2_23a9_f038_bac977e4f1f2 -->|method| 1d26cfc5_0ba4_d279_b820_08e5c8173506

Relationship Graph

Source Code

example/src/main/java/io/netty/example/http/cors/HttpCorsServerInitializer.java lines 73–96

public class HttpCorsServerInitializer extends ChannelInitializer<SocketChannel> {

    private final SslContext sslCtx;

    public HttpCorsServerInitializer(SslContext sslCtx) {
        this.sslCtx = sslCtx;
    }

    @Override
    public void initChannel(SocketChannel ch) {
        CorsConfig corsConfig = CorsConfigBuilder.forAnyOrigin().allowNullOrigin().allowCredentials().build();
        ChannelPipeline pipeline = ch.pipeline();
        if (sslCtx != null) {
            pipeline.addLast(sslCtx.newHandler(ch.alloc()));
        }
        pipeline.addLast(new HttpResponseEncoder());
        pipeline.addLast(new HttpRequestDecoder());
        pipeline.addLast(new HttpObjectAggregator(65536));
        pipeline.addLast(new ChunkedWriteHandler());
        pipeline.addLast(new CorsHandler(corsConfig));
        pipeline.addLast(new OkResponseHandler());
    }

}

Frequently Asked Questions

What is the HttpCorsServerInitializer class?
HttpCorsServerInitializer is a class in the netty codebase, defined in example/src/main/java/io/netty/example/http/cors/HttpCorsServerInitializer.java.
Where is HttpCorsServerInitializer defined?
HttpCorsServerInitializer is defined in example/src/main/java/io/netty/example/http/cors/HttpCorsServerInitializer.java at line 73.

Analyze Your Own Codebase

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

Try Supermodel Free