@Immutable class URLEncodedUtils extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
NAME_VALUE_SEPARATOR |
private static java.util.BitSet |
PATHSAFE
Characters which are safe to use in a path,
i.e.
|
private static java.util.BitSet |
PUNCT
Punctuation characters: , ; : $ & + =
|
private static char |
QP_SEP_A |
private static int |
RADIX |
private static java.util.BitSet |
RESERVED
Reserved characters, i.e.
|
private static java.util.BitSet |
UNRESERVED
Unreserved characters, i.e.
|
private static java.util.BitSet |
URIC
Characters which are safe to use in a query or a fragment,
i.e.
|
private static java.util.BitSet |
URLENCODER
Safe characters for x-www-form-urlencoded data, as per java.net.URLEncoder and browser behaviour,
i.e.
|
private static java.util.BitSet |
USERINFO
Characters which are safe to use in userinfo,
i.e.
|
Constructor and Description |
---|
URLEncodedUtils() |
Modifier and Type | Method and Description |
---|---|
private static java.lang.String |
encodeFormFields(java.lang.String content,
java.nio.charset.Charset charset)
Encode/escape www-url-form-encoded content.
|
private static java.lang.String |
encodeFormFields(java.lang.String content,
java.lang.String charset)
Encode/escape www-url-form-encoded content.
|
(package private) static java.lang.String |
encPath(java.lang.String content,
java.nio.charset.Charset charset)
Encode a String using the
PATHSAFE set of characters. |
(package private) static java.lang.String |
encUric(java.lang.String content,
java.nio.charset.Charset charset)
Encode a String using the
URIC set of characters. |
(package private) static java.lang.String |
encUserInfo(java.lang.String content,
java.nio.charset.Charset charset)
Encode a String using the
USERINFO set of characters. |
static java.lang.String |
format(java.lang.Iterable<? extends NameValuePair> parameters,
char parameterSeparator,
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.lang.Iterable<? extends 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 NameValuePair> parameters,
char parameterSeparator,
java.lang.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 java.lang.String |
format(java.util.List<? extends NameValuePair> parameters,
java.lang.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. |
private static java.lang.String |
urlEncode(java.lang.String content,
java.nio.charset.Charset charset,
java.util.BitSet safechars,
boolean blankAsPlus) |
private static final char QP_SEP_A
private static final java.lang.String NAME_VALUE_SEPARATOR
private static final java.util.BitSet UNRESERVED
_ - ! . ~ ' ( ) *
This list is the same as the unreserved
list in
RFC 2396
private static final java.util.BitSet PUNCT
These are the additional characters allowed by userinfo.
private static final java.util.BitSet USERINFO
UNRESERVED
plus PUNCT
uationprivate static final java.util.BitSet PATHSAFE
UNRESERVED
plus PUNCT
uation plus / @private static final java.util.BitSet URIC
RESERVED
plus UNRESERVED
private static final java.util.BitSet RESERVED
private static final java.util.BitSet URLENCODER
"-", "_", ".", "*"
private static final int RADIX
public static java.lang.String format(java.util.List<? extends NameValuePair> parameters, java.lang.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 java.lang.String format(java.util.List<? extends NameValuePair> parameters, char parameterSeparator, java.lang.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 java.lang.String format(java.lang.Iterable<? extends 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.application/x-www-form-urlencoded
stringpublic static java.lang.String format(java.lang.Iterable<? extends NameValuePair> parameters, char parameterSeparator, 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.parameterSeparator
- The parameter separator, by convention, '&'
or ';'
.charset
- The encoding to use.application/x-www-form-urlencoded
stringprivate static java.lang.String urlEncode(java.lang.String content, java.nio.charset.Charset charset, java.util.BitSet safechars, boolean blankAsPlus)
private static java.lang.String encodeFormFields(java.lang.String content, java.lang.String charset)
Uses the URLENCODER
set of characters, rather than
the #UNRSERVED
set; this is for compatibilty with previous
releases, URLEncoder.encode() and most browsers.
content
- the content to encode, will convert space to '+'charset
- the charset to useprivate static java.lang.String encodeFormFields(java.lang.String content, java.nio.charset.Charset charset)
Uses the URLENCODER
set of characters, rather than
the #UNRSERVED
set; this is for compatibilty with previous
releases, URLEncoder.encode() and most browsers.
content
- the content to encode, will convert space to '+'charset
- the charset to usestatic java.lang.String encUserInfo(java.lang.String content, java.nio.charset.Charset charset)
USERINFO
set of characters.
Used by URIBuilder to encode the userinfo segment.
content
- the string to encode, does not convert space to '+'charset
- the charset to usestatic java.lang.String encUric(java.lang.String content, java.nio.charset.Charset charset)
URIC
set of characters.
Used by URIBuilder to encode the query and fragment segments.
content
- the string to encode, does not convert space to '+'charset
- the charset to usestatic java.lang.String encPath(java.lang.String content, java.nio.charset.Charset charset)
PATHSAFE
set of characters.
Used by URIBuilder to encode path segments.
content
- the string to encode, does not convert space to '+'charset
- the charset to use