org.mortbay.util
Class UrlEncoded
public
class
UrlEncoded
extends MultiMap
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.
Version: $Id: UrlEncoded.java,v 1.24 2005/12/21 23:14:38 gregwilkins Exp $
Author: Greg Wilkins (gregw)
See Also: java.net.URLEncoder
Method Summary |
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. |
public UrlEncoded()
public UrlEncoded(String s)
public UrlEncoded(String s, String charset)
public Object clone()
public void decode(String query)
public void decode(String query, String charset)
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.
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.
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.
public static void decodeTo(String content,
MultiMap map)
public static void decodeTo(String content,
MultiMap map, String charset)
Decoded parameters to Map.
Parameters: content the string containing the encoded parameters
public static void decodeTo(byte[] data, int offset, int length,
MultiMap map, String charset)
Decoded parameters to Map.
Parameters: data the byte[] containing the encoded parameters
public String encode()
Encode Hashtable with % encoding.
public String encode(String charset)
Encode Hashtable with % encoding.
public String encode(String charset, boolean equalsForNullValue)
Encode Hashtable with % encoding.
Parameters: equalsForNullValue if True, then an '=' is always used, even
for parameters without a value. e.g. "blah?a=&b=&c=".
public static String encodeString(String string)
Perform URL encoding.
Assumes 8859 charset
Parameters: string
Returns: encoded string.
public static String encodeString(String string, String charset)
Perform URL encoding.
Parameters: string
Returns: encoded string.
Copyright © 2004 Mortbay Consulting Pty. Ltd. All Rights Reserved.