|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.netty.handler.codec.http2.QueryStringDecoder
public class QueryStringDecoder
Splits an HTTP query string into a path string and key-value parameter pairs. This decoder is for one time use only. Create a new instance for each URI:
QueryStringDecoder
decoder = newQueryStringDecoder
("/hello?recipient=world"); assert decoder.getPath().equals("/hello"); assert decoder.getParameters().get("recipient").equals("world");
QueryStringEncoder
Constructor Summary | |
---|---|
QueryStringDecoder(String uri)
Creates a new decoder that decodes the specified URI. |
|
QueryStringDecoder(String uri,
boolean hasPath)
Creates a new decoder that decodes the specified URI encoded in the specified charset. |
|
QueryStringDecoder(String uri,
Charset charset)
Creates a new decoder that decodes the specified URI encoded in the specified charset. |
|
QueryStringDecoder(String uri,
Charset charset,
boolean hasPath)
Creates a new decoder that decodes the specified URI encoded in the specified charset. |
|
QueryStringDecoder(String uri,
Charset charset,
boolean hasPath,
int maxParams)
Creates a new decoder that decodes the specified URI encoded in the specified charset. |
|
QueryStringDecoder(String uri,
String charset)
Deprecated. Use QueryStringDecoder(String, Charset) instead. |
|
QueryStringDecoder(URI uri)
Creates a new decoder that decodes the specified URI. |
|
QueryStringDecoder(URI uri,
Charset charset)
Creates a new decoder that decodes the specified URI encoded in the specified charset. |
|
QueryStringDecoder(URI uri,
Charset charset,
int maxParams)
Creates a new decoder that decodes the specified URI encoded in the specified charset. |
|
QueryStringDecoder(URI uri,
String charset)
Deprecated. Use QueryStringDecoder(URI, Charset) instead. |
Method Summary | |
---|---|
static String |
decodeComponent(String s)
Decodes a bit of an URL encoded by a browser. |
static String |
decodeComponent(String s,
Charset charset)
Decodes a bit of an URL encoded by a browser. |
Map<String,List<String>> |
getParameters()
Returns the decoded key-value parameter pairs of the URI. |
String |
getPath()
Returns the decoded path string of the URI. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public QueryStringDecoder(String uri)
public QueryStringDecoder(String uri, boolean hasPath)
public QueryStringDecoder(String uri, Charset charset)
public QueryStringDecoder(String uri, Charset charset, boolean hasPath)
public QueryStringDecoder(String uri, Charset charset, boolean hasPath, int maxParams)
@Deprecated public QueryStringDecoder(String uri, String charset)
QueryStringDecoder(String, Charset)
instead.
public QueryStringDecoder(URI uri)
public QueryStringDecoder(URI uri, Charset charset)
public QueryStringDecoder(URI uri, Charset charset, int maxParams)
@Deprecated public QueryStringDecoder(URI uri, String charset)
QueryStringDecoder(URI, Charset)
instead.
Method Detail |
---|
public String getPath()
public Map<String,List<String>> getParameters()
public static String decodeComponent(String s)
This is equivalent to calling decodeComponent(String, Charset)
with the UTF-8 charset (recommended to comply with RFC 3986, Section 2).
s
- The string to decode (can be empty).
s
if there's nothing to decode.
If the string to decode is null
, returns an empty string.
IllegalArgumentException
- if the string contains a malformed
escape sequence.public static String decodeComponent(String s, Charset charset)
The string is expected to be encoded as per RFC 3986, Section 2.
This is the encoding used by JavaScript functions encodeURI
and encodeURIComponent
, but not escape
. For example
in this encoding, é (in Unicode U+00E9
or in UTF-8
0xC3 0xA9
) is encoded as %C3%A9
or %c3%a9
.
This is essentially equivalent to calling
except that it's over 2x faster and generates less garbage for the GC.
Actually this function doesn't allocate any memory if there's nothing
to decode, the argument itself is returned.
URLDecoder.decode
(s, charset.name())
s
- The string to decode (can be empty).charset
- The charset to use to decode the string (should really
be CharsetUtil.UTF_8
.
s
if there's nothing to decode.
If the string to decode is null
, returns an empty string.
IllegalArgumentException
- if the string contains a malformed
escape sequence.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |