Home / Class/ Builder Class — netty Architecture

Builder Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  5a1ee6ec_9ac8_6f68_97ef_69f6ba9a9132["Builder"]
  6d9e37f1_0110_8bff_3ba6_1e9a06f9bcd9["QueryStringDecoder.java"]
  5a1ee6ec_9ac8_6f68_97ef_69f6ba9a9132 -->|defined in| 6d9e37f1_0110_8bff_3ba6_1e9a06f9bcd9
  6ca5ff04_e0cb_b8e3_1e04_0bb2a11dc09d["Builder()"]
  5a1ee6ec_9ac8_6f68_97ef_69f6ba9a9132 -->|method| 6ca5ff04_e0cb_b8e3_1e04_0bb2a11dc09d
  e0ea4a27_de5e_3a01_9f2f_d3e8a05db639["QueryStringDecoder()"]
  5a1ee6ec_9ac8_6f68_97ef_69f6ba9a9132 -->|method| e0ea4a27_de5e_3a01_9f2f_d3e8a05db639

Relationship Graph

Source Code

codec-http/src/main/java/io/netty/handler/codec/http/QueryStringDecoder.java lines 414–506

    public static final class Builder {
        private boolean hasPath = true;
        private int maxParams = DEFAULT_MAX_PARAMS;
        private boolean semicolonIsNormalChar;
        private Charset charset = HttpConstants.DEFAULT_CHARSET;
        private boolean htmlQueryDecoding = true;

        private Builder() {
        }

        /**
         * {@code true} by default. When set to {@code false}, the input string only contains the query component of
         * the URI.
         *
         * @param hasPath Whether the URI contains a path
         * @return This builder
         */
        public Builder hasPath(boolean hasPath) {
            this.hasPath = hasPath;
            return this;
        }

        /**
         * Maximum number of query parameters allowed, to mitigate HashDOS. {@value DEFAULT_MAX_PARAMS} by default.
         *
         * @param maxParams The maximum number of query parameters
         * @return This builder
         */
        public Builder maxParams(int maxParams) {
            this.maxParams = maxParams;
            return this;
        }

        /**
         * {@code false} by default. If set to {@code true}, instead of allowing query parameters to be separated by
         * semicolons, treat the semicolon as a normal character in a query value.
         *
         * @param semicolonIsNormalChar Whether to treat semicolons as a normal character
         * @return This builder
         */
        public Builder semicolonIsNormalChar(boolean semicolonIsNormalChar) {
            this.semicolonIsNormalChar = semicolonIsNormalChar;
            return this;
        }

        /**
         * The charset to use for decoding percent escape sequences. {@link HttpConstants#DEFAULT_CHARSET} by default.
         *
         * @param charset The charset
         * @return This builder
         */
        public Builder charset(Charset charset) {
            this.charset = charset;
            return this;
        }

        /**
         * RFC 3986 (the URI standard) makes no mention of using '+' to encode a space in a URI query component. The
         * whatwg HTML standard, however, defines the query to be encoded with the
         * {@code application/x-www-form-urlencoded} serializer defined in the whatwg URL standard, which does use '+'
         * to encode a space instead of {@code %20}.
         * <p>This flag controls whether the decoding should happen according to HTML rules, which decodes the '+' to a
         * space. The default is {@code true}.
         *
         * @param htmlQueryDecoding Whether to decode '+' to space
         * @return This builder
         */
        public Builder htmlQueryDecoding(boolean htmlQueryDecoding) {
            this.htmlQueryDecoding = htmlQueryDecoding;
            return this;
        }

        /**
         * Create a decoder that will lazily decode the given URI with the settings configured in this builder.
         *
         * @param uri The URI in String form
         * @return The decoder
         */
        public QueryStringDecoder build(String uri) {
            return new QueryStringDecoder(this, uri);
        }

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/QueryStringDecoder.java.
Where is Builder defined?
Builder is defined in codec-http/src/main/java/io/netty/handler/codec/http/QueryStringDecoder.java at line 414.

Analyze Your Own Codebase

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

Try Supermodel Free