public class HttpClientURLEncodedUtils
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CONTENT_TYPE |
| Constructor and Description |
|---|
HttpClientURLEncodedUtils() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
format(java.lang.Iterable<? extends org.apache.http.NameValuePair> parameters,
java.nio.charset.Charset charset)
Returns a String that is suitable for use as an
application/x-www-form-urlencoded list of parameters in an HTTP PUT or HTTP POST. |
static java.lang.String |
format(java.util.List<? extends org.apache.http.NameValuePair> parameters,
java.lang.String encoding)
Returns a String that is suitable for use as an
application/x-www-form-urlencoded list of parameters in an HTTP PUT or HTTP POST. |
static boolean |
isEncoded(org.apache.http.HttpEntity entity)
Returns true if the entity's Content-Type header is
application/x-www-form-urlencoded. |
static void |
parse(java.util.List<org.apache.http.NameValuePair> parameters,
java.util.Scanner scanner,
java.lang.String charset)
Adds all parameters within the Scanner to the list of
parameters, as encoded by encoding. |
static java.util.List<org.apache.http.NameValuePair> |
parse(java.lang.String s,
java.nio.charset.Charset charset)
Returns a list of
NameValuePairs as parsed from the given string using the given character encoding. |
static java.util.List<org.apache.http.NameValuePair> |
parse(java.lang.String query,
java.lang.String encoding)
Returns a list of
NameValuePairs as built from the URI's query portion. |
public static final java.lang.String CONTENT_TYPE
public static java.util.List<org.apache.http.NameValuePair> parse(java.lang.String query,
java.lang.String encoding)
NameValuePairs as built from the URI's query portion. For example, a URI of
http://example.org/path/to/file?a=1&b=2&c=3 would return a list of three NameValuePairs, one for a=1, one for b=2, and one for c=3.
This is typically useful while parsing an HTTP PUT.
query - query to parseencoding - encoding to use while parsing the querypublic static boolean isEncoded(org.apache.http.HttpEntity entity)
application/x-www-form-urlencoded.public static void parse(java.util.List<org.apache.http.NameValuePair> parameters,
java.util.Scanner scanner,
java.lang.String charset)
parameters, as encoded by encoding. For example, a scanner containing the
string a=1&b=2&c=3 would add the NameValuePairs a=1, b=2, and c=3 to the list of parameters.parameters - List to add parameters to.scanner - Input that contains the parameters to parse.charset - Encoding to use when decoding the parameters.public static java.util.List<org.apache.http.NameValuePair> parse(java.lang.String s,
java.nio.charset.Charset charset)
NameValuePairs as parsed from the given string using the given character encoding.s - text to parse.charset - Encoding to use when decoding the parameters.public static java.lang.String format(java.util.List<? extends org.apache.http.NameValuePair> parameters,
java.lang.String encoding)
application/x-www-form-urlencoded list of parameters in an HTTP PUT or HTTP POST.parameters - The parameters to include.encoding - The encoding to use.public static java.lang.String format(java.lang.Iterable<? extends org.apache.http.NameValuePair> parameters,
java.nio.charset.Charset charset)
application/x-www-form-urlencoded list of parameters in an HTTP PUT or HTTP POST.parameters - The parameters to include.charset - The encoding to use.