Home / Class/ ApplicationProtocolConfig Class — netty Architecture

ApplicationProtocolConfig Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  42631106_855b_b440_685d_5584e3002d25["ApplicationProtocolConfig"]
  2474a000_4a8d_fe84_9f89_3248f716144a["ApplicationProtocolConfig.java"]
  42631106_855b_b440_685d_5584e3002d25 -->|defined in| 2474a000_4a8d_fe84_9f89_3248f716144a
  3b277bdd_2c57_a438_4ebb_1aaae9e7b7f2["ApplicationProtocolConfig()"]
  42631106_855b_b440_685d_5584e3002d25 -->|method| 3b277bdd_2c57_a438_4ebb_1aaae9e7b7f2
  d4a1c19f_d182_3a2e_4b57_8bc5b12fb48b["supportedProtocols()"]
  42631106_855b_b440_685d_5584e3002d25 -->|method| d4a1c19f_d182_3a2e_4b57_8bc5b12fb48b
  0214a16a_382d_9d82_c8db_b0f09eccc03b["Protocol()"]
  42631106_855b_b440_685d_5584e3002d25 -->|method| 0214a16a_382d_9d82_c8db_b0f09eccc03b
  ff88772b_87d2_2364_69d0_5771735ce8ea["SelectorFailureBehavior()"]
  42631106_855b_b440_685d_5584e3002d25 -->|method| ff88772b_87d2_2364_69d0_5771735ce8ea
  08d7df9e_b15a_ddcf_b73f_5617e25ae4ad["SelectedListenerFailureBehavior()"]
  42631106_855b_b440_685d_5584e3002d25 -->|method| 08d7df9e_b15a_ddcf_b73f_5617e25ae4ad

Relationship Graph

Source Code

handler/src/main/java/io/netty/handler/ssl/ApplicationProtocolConfig.java lines 30–184

public final class ApplicationProtocolConfig {

    /**
     * The configuration that disables application protocol negotiation.
     */
    public static final ApplicationProtocolConfig DISABLED = new ApplicationProtocolConfig();

    private final List<String> supportedProtocols;
    private final Protocol protocol;
    private final SelectorFailureBehavior selectorBehavior;
    private final SelectedListenerFailureBehavior selectedBehavior;

    /**
     * Create a new instance.
     * @param protocol The application protocol functionality to use.
     * @param selectorBehavior How the peer selecting the protocol should behave.
     * @param selectedBehavior How the peer being notified of the selected protocol should behave.
     * @param supportedProtocols The order of iteration determines the preference of support for protocols.
     */
    public ApplicationProtocolConfig(Protocol protocol, SelectorFailureBehavior selectorBehavior,
            SelectedListenerFailureBehavior selectedBehavior, Iterable<String> supportedProtocols) {
        this(protocol, selectorBehavior, selectedBehavior, toList(supportedProtocols));
    }

    /**
     * Create a new instance.
     * @param protocol The application protocol functionality to use.
     * @param selectorBehavior How the peer selecting the protocol should behave.
     * @param selectedBehavior How the peer being notified of the selected protocol should behave.
     * @param supportedProtocols The order of iteration determines the preference of support for protocols.
     */
    public ApplicationProtocolConfig(Protocol protocol, SelectorFailureBehavior selectorBehavior,
            SelectedListenerFailureBehavior selectedBehavior, String... supportedProtocols) {
        this(protocol, selectorBehavior, selectedBehavior, toList(supportedProtocols));
    }

    /**
     * Create a new instance.
     * @param protocol The application protocol functionality to use.
     * @param selectorBehavior How the peer selecting the protocol should behave.
     * @param selectedBehavior How the peer being notified of the selected protocol should behave.
     * @param supportedProtocols The order of iteration determines the preference of support for protocols.
     */
    private ApplicationProtocolConfig(
            Protocol protocol, SelectorFailureBehavior selectorBehavior,
            SelectedListenerFailureBehavior selectedBehavior, List<String> supportedProtocols) {
        this.supportedProtocols = Collections.unmodifiableList(checkNotNull(supportedProtocols, "supportedProtocols"));
        this.protocol = checkNotNull(protocol, "protocol");
        this.selectorBehavior = checkNotNull(selectorBehavior, "selectorBehavior");
        this.selectedBehavior = checkNotNull(selectedBehavior, "selectedBehavior");

        if (protocol == Protocol.NONE) {
            throw new IllegalArgumentException("protocol (" + Protocol.NONE + ") must not be " + Protocol.NONE + '.');
        }
        checkNonEmpty(supportedProtocols, "supportedProtocols");
    }

    /**
     * A special constructor that is used to instantiate {@link #DISABLED}.
     */
    private ApplicationProtocolConfig() {
        supportedProtocols = Collections.emptyList();
        protocol = Protocol.NONE;
        selectorBehavior = SelectorFailureBehavior.CHOOSE_MY_LAST_PROTOCOL;
        selectedBehavior = SelectedListenerFailureBehavior.ACCEPT;
    }

    /**
     * Defines which application level protocol negotiation to use.
     */
    public enum Protocol {
        NONE, NPN, ALPN, NPN_AND_ALPN
    }

    /**
     * Defines the most common behaviors for the peer that selects the application protocol.
     */
    public enum SelectorFailureBehavior {
        /**
         * If the peer who selects the application protocol doesn't find a match this will result in the failing the
         * handshake with a fatal alert.

Frequently Asked Questions

What is the ApplicationProtocolConfig class?
ApplicationProtocolConfig is a class in the netty codebase, defined in handler/src/main/java/io/netty/handler/ssl/ApplicationProtocolConfig.java.
Where is ApplicationProtocolConfig defined?
ApplicationProtocolConfig is defined in handler/src/main/java/io/netty/handler/ssl/ApplicationProtocolConfig.java at line 30.

Analyze Your Own Codebase

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

Try Supermodel Free