This class handles the encoding and decoding for either the query string of a URL or the _content of a POST HTTP request.
NotesThe UTF-8 charset is assumed, unless otherwise defined by either passing a parameter or setting the "org.eclipse.jetty.util.UrlEncoding.charset" System property.
java.net.URLEncoder
| Modifier and Type | Field and Description |
|---|---|
| public static final Charset | |
| pack-priv static final Logger |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| private static void | |
| private static void | |
| public static void | decode88591To(InputStream
InputSteam to read in, MultiMap<String> MultiMap to add parameters to map, int maximum length of form to read or -1 for no limit maxLength, int maximum number of keys to read or -1 for no limit maxKeys)Decoded parameters to MultiMap, using ISO8859-1 encodings. |
| public static Charset | Returns: A Charset to use for decoding.The charset name for decoding or null for the default charsetName)
|
| public static byte | |
| private static char | |
| public static MultiMap | |
| public static String | Returns: the decoded stringthe encoded string to decode encoded)Decode String with % encoding. |
| public static String | Returns: the decoded stringthe encoded string to decode encoded, int the offset in the encoded string to decode from offset, int the length of characters in the encoded string to decode length, Charset the charset to use for decoding charset)Decode String with % encoding. |
| public static void | |
| public static void | |
| public static void | |
| public static void | decodeTo(String
the string containing the encoded parameters content, BiConsumer<String, String> a adder, Charset BiConsumer to accept the name/value pairs.the charset to use for decoding charset)Decoded parameters to Map. |
| public static void | decodeTo(InputStream
the stream containing the encoded parameters in, MultiMap<String> the MultiMap to decode into map, Charset the charset to use for decoding charset, int the maximum length of the form to decode maxLength, int the maximum number of keys to decode maxKeys)Decoded parameters to Map. |
| public static void | |
| public static void | decodeUtf8To(String
the URI query string. query, MultiMap<String> the map)MultiMap to store the fields.
Deprecated
use
decodeUtf8To(String, Fields) instead.
|
| public static void | decodeUtf8To(String
the URI query string. query, Fields the Fields to store the parameters. fields)Decodes URI query parameters into a |
| public static void | decodeUtf8To(String
the string containing the encoded parameters query, int the offset within raw to decode from offset, int the length of the section to decode length, MultiMap<String> the map)MultiMap to populate
Deprecated
use
Decoded parameters to Map.
decodeUtf8To(String, int, int, Fields) instead.
|
| public static void | decodeUtf8To(String
the URI string. uri, int the offset at which query parameters start. offset, int the length of query parameters string to parse. length, Fields the Fields to store the parameters. fields)Decodes URI query parameters into a |
| private static void | |
| public static void | decodeUtf8To(InputStream
InputSteam to read in, MultiMap<String> MultiMap to add parameters to map, int maximum form length to decode or -1 for no limit maxLength, int the maximum number of keys to read or -1 for no limit maxKeys)Decoded parameters to Map. |
| public static String | Returns: the MultiMap as a string encoded with % encodings.the map to encode map, Charset the charset to use for encoding (uses default encoding if null) charset, boolean if True, then an '=' is always used, even
for parameters without a value. e.g. equalsForNullValue)"blah?a=&b=&c=".Encode MultiMap with % encoding. |
| public static String | |
| public static String | Returns: encoded string.the string to encode string, Charset the charset to use for encoding charset)Perform URL encoding. |
| ENCODING | back to summary |
|---|---|
| public static final Charset ENCODING | |
| LOG | back to summary |
|---|---|
| pack-priv static final Logger LOG | |
| UrlEncoded | back to summary |
|---|---|
| private UrlEncoded() | |
| checkMaxKeys | back to summary |
|---|---|
| private static void checkMaxKeys(MultiMap<String> map, int maxKeys) | |
| checkMaxLength | back to summary |
|---|---|
| private static void checkMaxLength(int length, int maxLength) | |
| decode88591To | back to summary |
|---|---|
| public static void decode88591To(InputStream in, MultiMap<String> map, int maxLength, int maxKeys) throws IOException Decoded parameters to MultiMap, using ISO8859-1 encodings.
| |
| decodeCharset | back to summary |
|---|---|
| public static Charset decodeCharset(String charsetName) | |
| decodeHexByte | back to summary |
|---|---|
| public static byte decodeHexByte(char hi, char lo) | |
| decodeHexChar | back to summary |
|---|---|
| private static char decodeHexChar(int hi, int lo) | |
| decodeQuery | back to summary |
|---|---|
| public static MultiMap | |
| decodeString | back to summary |
|---|---|
| public static String decodeString(String encoded) Decode String with % encoding. This method makes the assumption that the majority of calls will need no decoding. | |
| decodeString | back to summary |
|---|---|
| public static String decodeString(String encoded, int offset, int length, Charset charset) Decode String with % encoding. This method makes the assumption that the majority of calls will need no decoding. | |
| decodeTo | back to summary |
|---|---|
| public static void decodeTo(String content, MultiMap<String> map, String charset)
Decoded parameters to Map.
| |
| decodeTo | back to summary |
|---|---|
| public static void decodeTo(String content, MultiMap<String> map, Charset charset) Decoded parameters to Map. | |
| decodeTo | back to summary |
|---|---|
| public static void decodeTo(String content, MultiMap<String> map, Charset charset, int maxKeys) Decoded parameters to Map. | |
| decodeTo | back to summary |
|---|---|
| public static void decodeTo(String content, BiConsumer<String, String> adder, Charset charset) Decoded parameters to Map.
| |
| decodeTo | back to summary |
|---|---|
| public static void decodeTo(InputStream in, MultiMap<String> map, Charset charset, int maxLength, int maxKeys) throws IOException Decoded parameters to Map.
| |
| decodeUtf16To | back to summary |
|---|---|
| public static void decodeUtf16To(InputStream in, MultiMap<String> map, int maxLength, int maxKeys) throws IOException | |
| decodeUtf8To | back to summary |
|---|---|
| public static void decodeUtf8To(String query, MultiMap<String> map)
Deprecated use
| |
| decodeUtf8To | back to summary |
|---|---|
| public static void decodeUtf8To(String query, Fields fields) Decodes URI query parameters into a | |
| decodeUtf8To | back to summary |
|---|---|
| public static void decodeUtf8To(String query, int offset, int length, MultiMap<String> map)
Deprecated use Decoded parameters to Map.
| |
| decodeUtf8To | back to summary |
|---|---|
| public static void decodeUtf8To(String uri, int offset, int length, Fields fields) Decodes URI query parameters into a | |
| decodeUtf8To | back to summary |
|---|---|
| private static void decodeUtf8To(String query, int offset, int length, BiConsumer<String, String> adder) | |
| decodeUtf8To | back to summary |
|---|---|
| public static void decodeUtf8To(InputStream in, MultiMap<String> map, int maxLength, int maxKeys) throws IOException Decoded parameters to Map.
| |
| encode | back to summary |
|---|---|
| public static String encode(MultiMap<String> map, Charset charset, boolean equalsForNullValue) Encode MultiMap with % encoding.
| |
| encodeString | back to summary |
|---|---|
| public static String encodeString(String string) Perform URL encoding. | |
| encodeString | back to summary |
|---|---|
| public static String encodeString(String string, Charset charset) Perform URL encoding. | |