Home / Function/ EmbeddedChannel() — netty Function Reference

EmbeddedChannel() — netty Function Reference

Architecture documentation for the EmbeddedChannel() function in HttpContentDecompressor.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  202dab4f_51dc_2e82_131f_60a2589457a6["EmbeddedChannel()"]
  eb09ff63_3d95_c8b4_bb21_43753487497a["HttpContentDecompressor"]
  202dab4f_51dc_2e82_131f_60a2589457a6 -->|defined in| eb09ff63_3d95_c8b4_bb21_43753487497a
  style 202dab4f_51dc_2e82_131f_60a2589457a6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http/src/main/java/io/netty/handler/codec/http/HttpContentDecompressor.java lines 92–144

    @Override
    protected EmbeddedChannel newContentDecoder(String contentEncoding) throws Exception {
        Channel channel = ctx.channel();
        if (GZIP.contentEqualsIgnoreCase(contentEncoding) ||
            X_GZIP.contentEqualsIgnoreCase(contentEncoding)) {
            return EmbeddedChannel.builder()
                    .channelId(channel.id())
                    .hasDisconnect(channel.metadata().hasDisconnect())
                    .config(channel.config())
                    .handlers(ZlibCodecFactory.newZlibDecoder(ZlibWrapper.GZIP, maxAllocation))
                    .build();
        }
        if (DEFLATE.contentEqualsIgnoreCase(contentEncoding) ||
            X_DEFLATE.contentEqualsIgnoreCase(contentEncoding)) {
            final ZlibWrapper wrapper = strict ? ZlibWrapper.ZLIB : ZlibWrapper.ZLIB_OR_NONE;
            // To be strict, 'deflate' means ZLIB, but some servers were not implemented correctly.
            return EmbeddedChannel.builder()
                    .channelId(channel.id())
                    .hasDisconnect(channel.metadata().hasDisconnect())
                    .config(channel.config())
                    .handlers(ZlibCodecFactory.newZlibDecoder(wrapper, maxAllocation))
                    .build();
        }
        if (Brotli.isAvailable() && BR.contentEqualsIgnoreCase(contentEncoding)) {
            return EmbeddedChannel.builder()
                    .channelId(channel.id())
                    .hasDisconnect(channel.metadata().hasDisconnect())
                    .config(channel.config())
                    .handlers(new BrotliDecoder())
                    .build();
        }

        if (SNAPPY.contentEqualsIgnoreCase(contentEncoding)) {
            return EmbeddedChannel.builder()
                    .channelId(channel.id())
                    .hasDisconnect(channel.metadata().hasDisconnect())
                    .config(channel.config())
                    .handlers(new SnappyFrameDecoder())
                    .build();
        }

        if (Zstd.isAvailable() && ZSTD.contentEqualsIgnoreCase(contentEncoding)) {
            return EmbeddedChannel.builder()
                    .channelId(channel.id())
                    .hasDisconnect(channel.metadata().hasDisconnect())
                    .config(channel.config())
                    .handlers(new ZstdDecoder())
                    .build();
        }

        // 'identity' or unsupported
        return null;
    }

Subdomains

Frequently Asked Questions

What does EmbeddedChannel() do?
EmbeddedChannel() is a function in the netty codebase, defined in codec-http/src/main/java/io/netty/handler/codec/http/HttpContentDecompressor.java.
Where is EmbeddedChannel() defined?
EmbeddedChannel() is defined in codec-http/src/main/java/io/netty/handler/codec/http/HttpContentDecompressor.java at line 92.

Analyze Your Own Codebase

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

Try Supermodel Free