Home / Function/ decode() — netty Function Reference

decode() — netty Function Reference

Architecture documentation for the decode() function in HttpContentEncoder.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  b5497765_76d0_d648_44c2_32a8f1535d9f["decode()"]
  77d3b233_ef0d_c6ed_64de_3e425b740522["HttpContentEncoder"]
  b5497765_76d0_d648_44c2_32a8f1535d9f -->|defined in| 77d3b233_ef0d_c6ed_64de_3e425b740522
  style b5497765_76d0_d648_44c2_32a8f1535d9f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http/src/main/java/io/netty/handler/codec/http/HttpContentEncoder.java lines 81–107

    @Override
    protected void decode(ChannelHandlerContext ctx, HttpRequest msg, List<Object> out) throws Exception {
        CharSequence acceptEncoding;
        List<String> acceptEncodingHeaders = msg.headers().getAll(ACCEPT_ENCODING);
        switch (acceptEncodingHeaders.size()) {
        case 0:
            acceptEncoding = HttpContentDecoder.IDENTITY;
            break;
        case 1:
            acceptEncoding = acceptEncodingHeaders.get(0);
            break;
        default:
            // Multiple message-header fields https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2
            acceptEncoding = StringUtil.join(",", acceptEncodingHeaders);
            break;
        }

        HttpMethod method = msg.method();
        if (HttpMethod.HEAD.equals(method)) {
            acceptEncoding = ZERO_LENGTH_HEAD;
        } else if (HttpMethod.CONNECT.equals(method)) {
            acceptEncoding = ZERO_LENGTH_CONNECT;
        }

        acceptEncodingQueue.add(acceptEncoding);
        out.add(ReferenceCountUtil.retain(msg));
    }

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free