Home / Class/ Builder Class — netty Architecture

Builder Class — netty Architecture

Architecture documentation for the Builder class in WebSocketServerProtocolConfig.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  ef65b8ea_1a4f_4709_808b_c0664bc25c1a["Builder"]
  e8767c74_dfe5_a28c_4fa2_4918427c8176["WebSocketServerProtocolConfig.java"]
  ef65b8ea_1a4f_4709_808b_c0664bc25c1a -->|defined in| e8767c74_dfe5_a28c_4fa2_4918427c8176
  45422123_29ec_055b_8153_c1fe0646892a["Builder()"]
  ef65b8ea_1a4f_4709_808b_c0664bc25c1a -->|method| 45422123_29ec_055b_8153_c1fe0646892a
  9082137e_731b_2266_6b85_64446fb3f081["decoderConfigBuilder()"]
  ef65b8ea_1a4f_4709_808b_c0664bc25c1a -->|method| 9082137e_731b_2266_6b85_64446fb3f081
  81c1d3af_acc9_0c2f_c7f8_fef8a9da5d17["WebSocketServerProtocolConfig()"]
  ef65b8ea_1a4f_4709_808b_c0664bc25c1a -->|method| 81c1d3af_acc9_0c2f_c7f8_fef8a9da5d17

Relationship Graph

Source Code

codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerProtocolConfig.java lines 122–295

    public static final class Builder {
        private String websocketPath;
        private String subprotocols;
        private boolean checkStartsWith;
        private long handshakeTimeoutMillis;
        private long forceCloseTimeoutMillis;
        private boolean handleCloseFrames;
        private WebSocketCloseStatus sendCloseFrame;
        private boolean dropPongFrames;
        private WebSocketDecoderConfig decoderConfig;
        private WebSocketDecoderConfig.Builder decoderConfigBuilder;

        private Builder(WebSocketServerProtocolConfig serverConfig) {
            this(ObjectUtil.checkNotNull(serverConfig, "serverConfig").websocketPath(),
                 serverConfig.subprotocols(),
                 serverConfig.checkStartsWith(),
                 serverConfig.handshakeTimeoutMillis(),
                 serverConfig.forceCloseTimeoutMillis(),
                 serverConfig.handleCloseFrames(),
                 serverConfig.sendCloseFrame(),
                 serverConfig.dropPongFrames(),
                 serverConfig.decoderConfig()
            );
        }

        private Builder(String websocketPath,
                        String subprotocols,
                        boolean checkStartsWith,
                        long handshakeTimeoutMillis,
                        long forceCloseTimeoutMillis,
                        boolean handleCloseFrames,
                        WebSocketCloseStatus sendCloseFrame,
                        boolean dropPongFrames,
                        WebSocketDecoderConfig decoderConfig) {
            this.websocketPath = websocketPath;
            this.subprotocols = subprotocols;
            this.checkStartsWith = checkStartsWith;
            this.handshakeTimeoutMillis = handshakeTimeoutMillis;
            this.forceCloseTimeoutMillis = forceCloseTimeoutMillis;
            this.handleCloseFrames = handleCloseFrames;
            this.sendCloseFrame = sendCloseFrame;
            this.dropPongFrames = dropPongFrames;
            this.decoderConfig = decoderConfig;
        }

        /**
         * URI path component to handle websocket upgrade requests on.
         */
        public Builder websocketPath(String websocketPath) {
            this.websocketPath = websocketPath;
            return this;
        }

        /**
         * CSV of supported protocols
         */
        public Builder subprotocols(String subprotocols) {
            this.subprotocols = subprotocols;
            return this;
        }

        /**
         * {@code true} to handle all requests, where URI path component starts from
         * {@link WebSocketServerProtocolConfig#websocketPath()}, {@code false} for exact match (default).
         */
        public Builder checkStartsWith(boolean checkStartsWith) {
            this.checkStartsWith = checkStartsWith;
            return this;
        }

        /**
         * Handshake timeout in mills, when handshake timeout, will trigger user
         * event {@link ClientHandshakeStateEvent#HANDSHAKE_TIMEOUT}
         */
        public Builder handshakeTimeoutMillis(long handshakeTimeoutMillis) {
            this.handshakeTimeoutMillis = handshakeTimeoutMillis;
            return this;
        }

        /**
         * Close the connection if it was not closed by the client after timeout specified

Frequently Asked Questions

What is the Builder class?
Builder is a class in the netty codebase, defined in codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerProtocolConfig.java.
Where is Builder defined?
Builder is defined in codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerProtocolConfig.java at line 122.

Analyze Your Own Codebase

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

Try Supermodel Free