Class QueryStringEncoder
java.lang.Object
org.jboss.netty.handler.codec.http.QueryStringEncoder
Creates an URL-encoded URI from a path string and key-value parameter pairs.
This encoder is for one time use only. Create a new instance for each URI.
QueryStringEncoder
encoder = newQueryStringEncoder
("/hello"); encoder.addParam("recipient", "world"); assert encoder.toString().equals("/hello?recipient=world");
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionQueryStringEncoder
(String uri) Creates a new encoder that encodes a URI that starts with the specified path string.QueryStringEncoder
(String uri, Charset charset) Creates a new encoder that encodes a URI that starts with the specified path string in the specified charset. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a parameter with the specified name and value to this encoder.private static String
encodeComponent
(String s, Charset charset) toString()
Returns the URL-encoded URI which was created from the path string specified in the constructor and the parameters added byaddParam(String, String)
method.toUri()
Returns the URL-encoded URI object which was created from the path string specified in the constructor and the parameters added byaddParam(String, String)
method.
-
Field Details
-
charset
-
uri
-
params
-
-
Constructor Details
-
QueryStringEncoder
Creates a new encoder that encodes a URI that starts with the specified path string. The encoder will encode the URI in UTF-8. -
QueryStringEncoder
Creates a new encoder that encodes a URI that starts with the specified path string in the specified charset.
-
-
Method Details
-
addParam
Adds a parameter with the specified name and value to this encoder. -
toUri
Returns the URL-encoded URI object which was created from the path string specified in the constructor and the parameters added byaddParam(String, String)
method.- Throws:
URISyntaxException
-
toString
Returns the URL-encoded URI which was created from the path string specified in the constructor and the parameters added byaddParam(String, String)
method. -
encodeComponent
-