Home / Function/ encode() — netty Function Reference

encode() — netty Function Reference

Architecture documentation for the encode() function in HttpClientCodec.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  8eeb8b8d_41b9_787d_b7c4_3e90425804e4["encode()"]
  be2ad3c4_e2cf_11ed_a380_b610e85eded0["Encoder"]
  8eeb8b8d_41b9_787d_b7c4_3e90425804e4 -->|defined in| be2ad3c4_e2cf_11ed_a380_b610e85eded0
  style 8eeb8b8d_41b9_787d_b7c4_3e90425804e4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http/src/main/java/io/netty/handler/codec/http/HttpClientCodec.java lines 276–299

        @Override
        protected void encode(
                ChannelHandlerContext ctx, Object msg, List<Object> out) throws Exception {

            if (upgraded) {
                // HttpObjectEncoder overrides .write and does not release msg, so we don't need to retain it here
                out.add(msg);
                return;
            }

            if (msg instanceof HttpRequest) {
                queue.offer(((HttpRequest) msg).method());
            }

            super.encode(ctx, msg, out);

            if (failOnMissingResponse && !done) {
                // check if the request is chunked if so do not increment
                if (msg instanceof LastHttpContent) {
                    // increment as its the last chunk
                    requestResponseCounter.incrementAndGet();
                }
            }
        }

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free