org.mortbay.util
Class UrlEncoded
- Cloneable
Handles coding of MIME "x-www-form-urlencoded".
This class handles the encoding and decoding for either
the query string of a URL or the content of a POST HTTP request.
Notes
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.
$Id: UrlEncoded.java,v 1.24 2005/12/21 23:14:38 gregwilkins Exp $
Object | clone()
|
void | decode(String query)
|
void | decode(String query, String charset)
|
static String | decodeString(String encoded) - Decode String with % encoding.
|
static String | decodeString(String encoded, String charset) - Decode String with % encoding.
|
static String | decodeString(String encoded, int offset, int length, String charset) - Decode String with % encoding.
|
static void | decodeTo(String content, MultiMap map)
|
static void | decodeTo(String content, MultiMap map, String charset) - Decoded parameters to Map.
|
static void | decodeTo(byte[] data, int offset, int length, MultiMap map, String charset) - Decoded parameters to Map.
|
String | encode() - 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 , clone , get , getString , getValue , getValues , put , putAll , putValues , putValues , removeValue , toStringArrayMap |
UrlEncoded
public UrlEncoded()
UrlEncoded
public UrlEncoded(String s)
UrlEncoded
public UrlEncoded(String s,
String charset)
decode
public void decode(String query)
decode
public void decode(String query,
String charset)
decodeString
public static String decodeString(String encoded)
Decode String with % encoding.
This method makes the assumption that the majority of calls
will need no decoding and uses the 8859 encoding.
decodeString
public static String decodeString(String encoded,
String charset)
Decode String with % encoding.
This method makes the assumption that the majority of calls
will need no decoding.
decodeString
public static String decodeString(String encoded,
int offset,
int length,
String charset)
Decode String with % encoding.
This method makes the assumption that the majority of calls
will need no decoding.
decodeTo
public static void decodeTo(String content,
MultiMap map)
decodeTo
public static void decodeTo(String content,
MultiMap map,
String charset)
Decoded parameters to Map.
content
- the string containing the encoded parameters
decodeTo
public static void decodeTo(byte[] data,
int offset,
int length,
MultiMap map,
String charset)
Decoded parameters to Map.
data
- the byte[] containing the encoded parameters
encode
public String encode()
Encode Hashtable with % encoding.
encode
public String encode(String charset)
Encode Hashtable with % encoding.
encode
public String encode(String charset,
boolean equalsForNullValue)
Encode Hashtable with % encoding.
equalsForNullValue
- if True, then an '=' is always used, even
for parameters without a value. e.g. "blah?a=&b=&c=".
encodeString
public static String encodeString(String string)
Perform URL encoding.
Assumes 8859 charset
encodeString
public static String encodeString(String string,
String charset)
Perform URL encoding.
Copyright © 2004 Mortbay Consulting Pty. Ltd. All Rights Reserved.