public class URLEncodedUtils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
CONTENT_TYPE
The default HTML form content type.
|
Constructor and Description |
---|
URLEncodedUtils() |
Modifier and Type | Method and Description |
---|---|
static String |
format(Iterable<? extends org.apache.http.NameValuePair> parameters,
char parameterSeparator,
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 String |
format(Iterable<? extends org.apache.http.NameValuePair> parameters,
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 String |
format(List<? extends org.apache.http.NameValuePair> parameters,
char parameterSeparator,
String 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 String |
format(List<? extends org.apache.http.NameValuePair> parameters,
String 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 String |
formatSegments(Iterable<String> segments,
Charset charset)
Returns a string consisting of joint encoded path segments.
|
static String |
formatSegments(String... segments)
Returns a string consisting of joint encoded path segments.
|
static boolean |
isEncoded(org.apache.http.HttpEntity entity)
Returns true if the entity's Content-Type header is
application/x-www-form-urlencoded . |
static List<org.apache.http.NameValuePair> |
parse(org.apache.http.util.CharArrayBuffer buf,
Charset charset,
char... separators)
Returns a list of
NameValuePair s parameters. |
static List<org.apache.http.NameValuePair> |
parse(org.apache.http.HttpEntity entity)
Returns a list of
NameValuePairs as parsed from an HttpEntity . |
static void |
parse(List<org.apache.http.NameValuePair> parameters,
Scanner scanner,
String charset)
Deprecated.
(4.4) use
parse(String, java.nio.charset.Charset) |
static void |
parse(List<org.apache.http.NameValuePair> parameters,
Scanner scanner,
String parameterSepartorPattern,
String charset)
Deprecated.
|
static List<org.apache.http.NameValuePair> |
parse(String s,
Charset charset)
Returns a list of
NameValuePair s URI query parameters. |
static List<org.apache.http.NameValuePair> |
parse(String s,
Charset charset,
char... separators)
Returns a list of
NameValuePairs as parsed from the given string using the given character
encoding. |
static List<org.apache.http.NameValuePair> |
parse(URI uri,
Charset charset)
Returns a list of
NameValuePair s URI query parameters. |
static List<org.apache.http.NameValuePair> |
parse(URI uri,
String charsetName)
Deprecated.
4.5 Use
parse(URI, Charset) |
static List<String> |
parsePathSegments(CharSequence s)
Returns a list of URI path segments.
|
static List<String> |
parsePathSegments(CharSequence s,
Charset charset)
Returns a list of URI path segments.
|
public static final String CONTENT_TYPE
@Deprecated public static List<org.apache.http.NameValuePair> parse(URI uri, String charsetName)
parse(URI, Charset)
public static List<org.apache.http.NameValuePair> parse(URI uri, Charset charset)
NameValuePair
s URI query parameters.
By convention, '&'
and ';'
are accepted as parameter separators.uri
- input URI.charset
- parameter charset.public static List<org.apache.http.NameValuePair> parse(org.apache.http.HttpEntity entity) throws IOException
NameValuePairs
as parsed from an HttpEntity
.
The encoding is taken from the entity's Content-Encoding header.
This is typically used while parsing an HTTP POST.
entity
- The entity to parseNameValuePair
as built from the URI's query portion.IOException
- If there was an exception getting the entity's data.public static boolean isEncoded(org.apache.http.HttpEntity entity)
application/x-www-form-urlencoded
.@Deprecated public static void parse(List<org.apache.http.NameValuePair> parameters, Scanner scanner, String charset)
parse(String, java.nio.charset.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. By convention, '&'
and
';'
are accepted as parameter separators.parameters
- List to add parameters to.scanner
- Input that contains the parameters to parse.charset
- Encoding to use when decoding the parameters.@Deprecated public static void parse(List<org.apache.http.NameValuePair> parameters, Scanner scanner, String parameterSepartorPattern, String charset)
parse(org.apache.http.util.CharArrayBuffer, java.nio.charset.Charset, char...)
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.parameterSepartorPattern
- The Pattern string for parameter separators, by convention "[&;]"
charset
- Encoding to use when decoding the parameters.public static List<org.apache.http.NameValuePair> parse(String s, Charset charset)
NameValuePair
s URI query parameters.
By convention, '&'
and ';'
are accepted as parameter separators.s
- URI query component.charset
- charset to use when decoding the parameters.public static List<org.apache.http.NameValuePair> parse(String s, Charset charset, char... separators)
NameValuePairs
as parsed from the given string using the given character
encoding.s
- input text.charset
- parameter charset.separators
- parameter separators.public static List<org.apache.http.NameValuePair> parse(org.apache.http.util.CharArrayBuffer buf, Charset charset, char... separators)
NameValuePair
s parameters.buf
- text to parse.charset
- Encoding to use when decoding the parameters.separators
- element separators.NameValuePair
as built from the URI's query portion.public static List<String> parsePathSegments(CharSequence s, Charset charset)
s
- URI path component.charset
- parameter charset.public static List<String> parsePathSegments(CharSequence s)
s
- URI path component.public static String formatSegments(Iterable<String> segments, Charset charset)
segments
- the segments.charset
- parameter charset.public static String formatSegments(String... segments)
segments
- the segments.public static String format(List<? extends org.apache.http.NameValuePair> parameters, String 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.application/x-www-form-urlencoded
stringpublic static String format(List<? extends org.apache.http.NameValuePair> parameters, char parameterSeparator, String charset)
application/x-www-form-urlencoded
list of parameters in an HTTP PUT or HTTP POST.parameters
- The parameters to include.parameterSeparator
- The parameter separator, by convention, '&'
or ';'
.charset
- The encoding to use.application/x-www-form-urlencoded
stringpublic static String format(Iterable<? extends org.apache.http.NameValuePair> parameters, 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.application/x-www-form-urlencoded
stringpublic static String format(Iterable<? extends org.apache.http.NameValuePair> parameters, char parameterSeparator, Charset charset)
application/x-www-form-urlencoded
list of parameters in an HTTP PUT or HTTP POST.parameters
- The parameters to include.parameterSeparator
- The parameter separator, by convention, '&'
or ';'
.charset
- The encoding to use.application/x-www-form-urlencoded
stringCopyright © 1999–2022 The Apache Software Foundation. All rights reserved.