Class QueryStringDecoder.Builder

java.lang.Object
io.netty.handler.codec.http.QueryStringDecoder.Builder
Enclosing class:
QueryStringDecoder

public static final class QueryStringDecoder.Builder extends Object
  • Field Details

    • hasPath

      private boolean hasPath
    • maxParams

      private int maxParams
    • semicolonIsNormalChar

      private boolean semicolonIsNormalChar
    • charset

      private Charset charset
    • htmlQueryDecoding

      private boolean htmlQueryDecoding
  • Constructor Details

    • Builder

      private Builder()
  • Method Details

    • hasPath

      public QueryStringDecoder.Builder hasPath(boolean hasPath)
      true by default. When set to false, the input string only contains the query component of the URI.
      Parameters:
      hasPath - Whether the URI contains a path
      Returns:
      This builder
    • maxParams

      public QueryStringDecoder.Builder maxParams(int maxParams)
      Maximum number of query parameters allowed, to mitigate HashDOS. 1024 by default.
      Parameters:
      maxParams - The maximum number of query parameters
      Returns:
      This builder
    • semicolonIsNormalChar

      public QueryStringDecoder.Builder semicolonIsNormalChar(boolean semicolonIsNormalChar)
      false by default. If set to true, instead of allowing query parameters to be separated by semicolons, treat the semicolon as a normal character in a query value.
      Parameters:
      semicolonIsNormalChar - Whether to treat semicolons as a normal character
      Returns:
      This builder
    • charset

      public QueryStringDecoder.Builder charset(Charset charset)
      The charset to use for decoding percent escape sequences. HttpConstants.DEFAULT_CHARSET by default.
      Parameters:
      charset - The charset
      Returns:
      This builder
    • htmlQueryDecoding

      public QueryStringDecoder.Builder htmlQueryDecoding(boolean htmlQueryDecoding)
      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 application/x-www-form-urlencoded serializer defined in the whatwg URL standard, which does use '+' to encode a space instead of %20.

      This flag controls whether the decoding should happen according to HTML rules, which decodes the '+' to a space. The default is true.

      Parameters:
      htmlQueryDecoding - Whether to decode '+' to space
      Returns:
      This builder
    • build

      public QueryStringDecoder build(String uri)
      Create a decoder that will lazily decode the given URI with the settings configured in this builder.
      Parameters:
      uri - The URI in String form
      Returns:
      The decoder
    • build

      public QueryStringDecoder build(URI uri)
      Create a decoder that will lazily decode the given URI with the settings configured in this builder. Note that hasPath(boolean) has no effect when using this method.
      Parameters:
      uri - The already parsed URI
      Returns:
      The decoder