public class UrlEncoded extends MultiMap implements Cloneable
This class handles the encoding and decoding for either the query string of a URL or the _content of a POST HTTP request.
The hashtable either contains String single values, vectors of String or arrays of Strings.
This class is only partially synchronised. In particular, simple get operations are not protected from concurrent updates.
URLEncoder
,
Serialized FormConstructor and Description |
---|
UrlEncoded() |
UrlEncoded(String s) |
UrlEncoded(String s,
String charset) |
UrlEncoded(UrlEncoded url) |
Modifier and Type | Method and Description |
---|---|
Object |
clone() |
void |
decode(String query) |
void |
decode(String query,
String charset) |
static void |
decode88591To(InputStream in,
MultiMap map,
int maxLength,
int maxKeys)
Decoded parameters to Map.
|
static String |
decodeString(String encoded,
int offset,
int length,
String charset)
Decode String with % encoding.
|
static void |
decodeTo(InputStream in,
MultiMap map,
String charset,
int maxLength,
int maxKeys)
Decoded parameters to Map.
|
static void |
decodeTo(String content,
MultiMap map,
String charset)
Decoded parameters to Map.
|
static void |
decodeTo(String content,
MultiMap map,
String charset,
int maxKeys)
Decoded parameters to Map.
|
static void |
decodeUtf16To(InputStream in,
MultiMap map,
int maxLength,
int maxKeys) |
static void |
decodeUtf8To(byte[] raw,
int offset,
int length,
MultiMap map)
Decoded parameters to Map.
|
static void |
decodeUtf8To(byte[] raw,
int offset,
int length,
MultiMap map,
Utf8StringBuilder buffer)
Decoded parameters to Map.
|
static void |
decodeUtf8To(InputStream in,
MultiMap map,
int maxLength,
int maxKeys)
Decoded parameters to Map.
|
String |
encode()
Encode Hashtable with % encoding.
|
static String |
encode(MultiMap map,
String charset,
boolean equalsForNullValue)
Encode Hashtable with % encoding.
|
String |
encode(String charset)
Encode Hashtable with % encoding.
|
String |
encode(String charset,
boolean equalsForNullValue)
Encode Hashtable with % encoding.
|
static String |
encodeString(String string)
Perform URL encoding.
|
static String |
encodeString(String string,
String charset)
Perform URL encoding.
|
add, addValues, addValues, clear, containsKey, containsValue, entrySet, equals, get, getString, getValue, getValues, hashCode, isEmpty, keySet, put, putAll, putIfAbsent, putValues, putValues, remove, remove, removeValue, replace, replace, size, toString, toStringArrayMap, values
public static final String ENCODING
public UrlEncoded(UrlEncoded url)
public UrlEncoded()
public UrlEncoded(String s)
public void decode(String query)
public String encode()
public String encode(String charset, boolean equalsForNullValue)
equalsForNullValue
- if True, then an '=' is always used, even
for parameters without a value. e.g. "blah?a=&b=&c=".public static String encode(MultiMap map, String charset, boolean equalsForNullValue)
equalsForNullValue
- if True, then an '=' is always used, even
for parameters without a value. e.g. "blah?a=&b=&c=".public static void decodeTo(String content, MultiMap map, String charset)
content
- the string containing the encoded parameterspublic static void decodeTo(String content, MultiMap map, String charset, int maxKeys)
content
- the string containing the encoded parameterspublic static void decodeUtf8To(byte[] raw, int offset, int length, MultiMap map)
raw
- the byte[] containing the encoded parametersoffset
- the offset within raw to decode fromlength
- the length of the section to decodemap
- the MultiMap
to populatepublic static void decodeUtf8To(byte[] raw, int offset, int length, MultiMap map, Utf8StringBuilder buffer)
raw
- the byte[] containing the encoded parametersoffset
- the offset within raw to decode fromlength
- the length of the section to decodemap
- the MultiMap
to populatebuffer
- the buffer to decode intopublic static void decode88591To(InputStream in, MultiMap map, int maxLength, int maxKeys) throws IOException
in
- InputSteam to readmap
- MultiMap to add parameters tomaxLength
- maximum number of keys to read or -1 for no limitIOException
public static void decodeUtf8To(InputStream in, MultiMap map, int maxLength, int maxKeys) throws IOException
in
- InputSteam to readmap
- MultiMap to add parameters tomaxLength
- maximum number of keys to read or -1 for no limitIOException
public static void decodeUtf16To(InputStream in, MultiMap map, int maxLength, int maxKeys) throws IOException
IOException
public static void decodeTo(InputStream in, MultiMap map, String charset, int maxLength, int maxKeys) throws IOException
in
- the stream containing the encoded parametersIOException
public static String decodeString(String encoded, int offset, int length, String charset)
public static String encodeString(String string)
string
- public static String encodeString(String string, String charset)
string
- Copyright © 1995-2013 Mort Bay Consulting. All Rights Reserved.