Package io.netty.handler.codec.http
Class QueryStringDecoder.Builder
- java.lang.Object
-
- io.netty.handler.codec.http.QueryStringDecoder.Builder
-
- Enclosing class:
- QueryStringDecoder
public static final class QueryStringDecoder.Builder extends java.lang.Object
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description QueryStringDecoder
build(java.lang.String uri)
Create a decoder that will lazily decode the given URI with the settings configured in this builder.QueryStringDecoder
build(java.net.URI uri)
Create a decoder that will lazily decode the given URI with the settings configured in this builder.QueryStringDecoder.Builder
charset(java.nio.charset.Charset charset)
The charset to use for decoding percent escape sequences.QueryStringDecoder.Builder
hasPath(boolean hasPath)
true
by default.QueryStringDecoder.Builder
htmlQueryDecoding(boolean htmlQueryDecoding)
RFC 3986 (the URI standard) makes no mention of using '+' to encode a space in a URI query component.QueryStringDecoder.Builder
maxParams(int maxParams)
Maximum number of query parameters allowed, to mitigate HashDOS.QueryStringDecoder.Builder
semicolonIsNormalChar(boolean semicolonIsNormalChar)
false
by default.
-
-
-
Method Detail
-
hasPath
public QueryStringDecoder.Builder hasPath(boolean hasPath)
true
by default. When set tofalse
, 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 totrue
, 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(java.nio.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 theapplication/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(java.lang.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(java.net.URI uri)
Create a decoder that will lazily decode the given URI with the settings configured in this builder. Note thathasPath(boolean)
has no effect when using this method.- Parameters:
uri
- The already parsed URI- Returns:
- The decoder
-
-