Home / Class/ Http2ClientUpgradeCodec Class — netty Architecture

Http2ClientUpgradeCodec Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  05b8b9b6_95f6_6e56_1d66_6116444fa08c["Http2ClientUpgradeCodec"]
  339b34a1_8b31_974b_4bb6_053e52796c58["Http2ClientUpgradeCodec.java"]
  05b8b9b6_95f6_6e56_1d66_6116444fa08c -->|defined in| 339b34a1_8b31_974b_4bb6_053e52796c58
  706bd43a_ba39_2dae_f533_52dcfe813bc2["Http2ClientUpgradeCodec()"]
  05b8b9b6_95f6_6e56_1d66_6116444fa08c -->|method| 706bd43a_ba39_2dae_f533_52dcfe813bc2
  12a9017b_fc6f_be6f_ad2f_c52178eaae32["CharSequence()"]
  05b8b9b6_95f6_6e56_1d66_6116444fa08c -->|method| 12a9017b_fc6f_be6f_ad2f_c52178eaae32
  f0c307b5_c822_8a84_0ea6_fe7d5ae5297d["setUpgradeHeaders()"]
  05b8b9b6_95f6_6e56_1d66_6116444fa08c -->|method| f0c307b5_c822_8a84_0ea6_fe7d5ae5297d
  f1645f57_ba10_d57d_8001_5ea9b7805279["upgradeTo()"]
  05b8b9b6_95f6_6e56_1d66_6116444fa08c -->|method| f1645f57_ba10_d57d_8001_5ea9b7805279

Relationship Graph

Source Code

codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ClientUpgradeCodec.java lines 41–173

public class Http2ClientUpgradeCodec implements HttpClientUpgradeHandler.UpgradeCodec {

    private static final List<CharSequence> UPGRADE_HEADERS = Collections.singletonList(HTTP_UPGRADE_SETTINGS_HEADER);

    private final String handlerName;
    private final Http2ConnectionHandler connectionHandler;
    private final ChannelHandler upgradeToHandler;
    private final ChannelHandler http2MultiplexHandler;

    public Http2ClientUpgradeCodec(Http2FrameCodec frameCodec, ChannelHandler upgradeToHandler) {
        this(null, frameCodec, upgradeToHandler);
    }

    public Http2ClientUpgradeCodec(String handlerName, Http2FrameCodec frameCodec, ChannelHandler upgradeToHandler) {
        this(handlerName, (Http2ConnectionHandler) frameCodec, upgradeToHandler, null);
    }

    /**
     * Creates the codec using a default name for the connection handler when adding to the
     * pipeline.
     *
     * @param connectionHandler the HTTP/2 connection handler
     */
    public Http2ClientUpgradeCodec(Http2ConnectionHandler connectionHandler) {
        this((String) null, connectionHandler);
    }

    /**
     * Creates the codec using a default name for the connection handler when adding to the
     * pipeline.
     *
     * @param connectionHandler the HTTP/2 connection handler
     * @param http2MultiplexHandler the Http2 Multiplexer handler to work with Http2FrameCodec
     */
    public Http2ClientUpgradeCodec(Http2ConnectionHandler connectionHandler,
        Http2MultiplexHandler http2MultiplexHandler) {
        this((String) null, connectionHandler, http2MultiplexHandler);
    }

    /**
     * Creates the codec providing an upgrade to the given handler for HTTP/2.
     *
     * @param handlerName the name of the HTTP/2 connection handler to be used in the pipeline,
     *                    or {@code null} to auto-generate the name
     * @param connectionHandler the HTTP/2 connection handler
     */
    public Http2ClientUpgradeCodec(String handlerName, Http2ConnectionHandler connectionHandler) {
        this(handlerName, connectionHandler, connectionHandler, null);
    }

    /**
     * Creates the codec providing an upgrade to the given handler for HTTP/2.
     *
     * @param handlerName the name of the HTTP/2 connection handler to be used in the pipeline,
     *                    or {@code null} to auto-generate the name
     * @param connectionHandler the HTTP/2 connection handler
     */
    public Http2ClientUpgradeCodec(String handlerName, Http2ConnectionHandler connectionHandler,
        Http2MultiplexHandler http2MultiplexHandler) {
        this(handlerName, connectionHandler, connectionHandler, http2MultiplexHandler);
    }

    private Http2ClientUpgradeCodec(String handlerName, Http2ConnectionHandler connectionHandler, ChannelHandler
        upgradeToHandler, Http2MultiplexHandler http2MultiplexHandler) {
        this.handlerName = handlerName;
        this.connectionHandler = checkNotNull(connectionHandler, "connectionHandler");
        this.upgradeToHandler = checkNotNull(upgradeToHandler, "upgradeToHandler");
        this.http2MultiplexHandler = http2MultiplexHandler;
    }

    @Override
    public CharSequence protocol() {
        return HTTP_UPGRADE_PROTOCOL_NAME;
    }

    @Override
    public Collection<CharSequence> setUpgradeHeaders(ChannelHandlerContext ctx,
        HttpRequest upgradeRequest) {
        CharSequence settingsValue = getSettingsHeaderValue(ctx);
        upgradeRequest.headers().set(HTTP_UPGRADE_SETTINGS_HEADER, settingsValue);
        return UPGRADE_HEADERS;

Frequently Asked Questions

What is the Http2ClientUpgradeCodec class?
Http2ClientUpgradeCodec is a class in the netty codebase, defined in codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ClientUpgradeCodec.java.
Where is Http2ClientUpgradeCodec defined?
Http2ClientUpgradeCodec is defined in codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ClientUpgradeCodec.java at line 41.

Analyze Your Own Codebase

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

Try Supermodel Free