Home / Type/ UpgradeCodec Type — netty Architecture

UpgradeCodec Type — netty Architecture

Architecture documentation for the UpgradeCodec type/interface in HttpServerUpgradeHandler.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  96b8d7b6_b5b8_f132_81dc_88d565ce0fa6["UpgradeCodec"]
  5d7a491e_b999_dfe7_d7db_9b5071c06005["HttpServerUpgradeHandler.java"]
  96b8d7b6_b5b8_f132_81dc_88d565ce0fa6 -->|defined in| 5d7a491e_b999_dfe7_d7db_9b5071c06005
  style 96b8d7b6_b5b8_f132_81dc_88d565ce0fa6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http/src/main/java/io/netty/handler/codec/http/HttpServerUpgradeHandler.java lines 56–82

    public interface UpgradeCodec {
        /**
         * Gets all protocol-specific headers required by this protocol for a successful upgrade.
         * Any supplied header will be required to appear in the {@link HttpHeaderNames#CONNECTION} header as well.
         */
        Collection<CharSequence> requiredUpgradeHeaders();

        /**
         * Prepares the {@code upgradeHeaders} for a protocol update based upon the contents of {@code upgradeRequest}.
         * This method returns a boolean value to proceed or abort the upgrade in progress. If {@code false} is
         * returned, the upgrade is aborted and the {@code upgradeRequest} will be passed through the inbound pipeline
         * as if no upgrade was performed. If {@code true} is returned, the upgrade will proceed to the next
         * step which invokes {@link #upgradeTo}. When returning {@code true}, you can add headers to
         * the {@code upgradeHeaders} so that they are added to the 101 Switching protocols response.
         */
        boolean prepareUpgradeResponse(ChannelHandlerContext ctx, FullHttpRequest upgradeRequest,
                                    HttpHeaders upgradeHeaders);

        /**
         * Performs an HTTP protocol upgrade from the source codec. This method is responsible for
         * adding all handlers required for the new protocol.
         *
         * @param ctx the context for the current handler.
         * @param upgradeRequest the request that triggered the upgrade to this protocol.
         */
        void upgradeTo(ChannelHandlerContext ctx, FullHttpRequest upgradeRequest);
    }

Frequently Asked Questions

What is the UpgradeCodec type?
UpgradeCodec is a type/interface in the netty codebase, defined in codec-http/src/main/java/io/netty/handler/codec/http/HttpServerUpgradeHandler.java.
Where is UpgradeCodec defined?
UpgradeCodec is defined in codec-http/src/main/java/io/netty/handler/codec/http/HttpServerUpgradeHandler.java at line 56.

Analyze Your Own Codebase

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

Try Supermodel Free