## org.mortbay.util
Class UrlEncoded

    java.lang.Object
      |
      +--java.util.AbstractMap
            |
            +--java.util.HashMap
                  |
                  +--org.mortbay.util.MultiMap
                        |
                        +--org.mortbay.util.UrlEncoded

All Implemented Interfaces:
  java.lang.Cloneable, java.util.Map, java.io.Serializable

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.17.2.1 2003/10/28 08:32:05 gregwilkins Exp $
Author:
  Greg Wilkins (gregw)
See Also:
  `URLEncoder`, Serialized Form

Constructor Summary
`UrlEncoded()`
`UrlEncoded(java.lang.String s)`
`UrlEncoded(java.lang.String s, java.lang.String charset)`
`UrlEncoded(UrlEncoded url)`

Method Summary
`java.lang.Object` `clone()`
`void` `decode(java.lang.String query)`
`void` `decode(java.lang.String query, java.lang.String charset)`
`static java.lang.String` `decodeString(java.lang.String encoded)` Decode String with % encoding.
`static java.lang.String` `decodeString(java.lang.String encoded, int offset, int length, java.lang.String charset)` Decode String with % encoding.
`static java.lang.String` `decodeString(java.lang.String encoded, java.lang.String charset)` Decode String with % encoding.
`static void` `decodeTo(byte[] data, int offset, int length, MultiMap map, java.lang.String charset)` Decoded parameters to Map.
`static void` `decodeTo(java.lang.String content, MultiMap map)`
`static void` `decodeTo(java.lang.String content, MultiMap map, java.lang.String charset)` Decoded parameters to Map.
`java.lang.String` `encode()` Encode Hashtable with % encoding.
`java.lang.String` `encode(java.lang.String charset)` Encode Hashtable with % encoding.
`java.lang.String` `encode(java.lang.String charset, boolean equalsForNullValue)` Encode Hashtable with % encoding.
`static java.lang.String` `encodeString(java.lang.String string)` Perform URL encoding.
`static java.lang.String` `encodeString(java.lang.String string, java.lang.String charset)` Perform URL encoding.

Methods inherited from class org.mortbay.util.MultiMap
`add, addValues, addValues, get, getString, getValue, getValues, put, putAll, putValues, putValues, removeValue, toStringArrayMap`

Methods inherited from class java.util.HashMap
`clear, containsKey, containsValue, entrySet, isEmpty, keySet, remove, size, values`

Methods inherited from class java.util.AbstractMap
`equals, hashCode, toString`

Methods inherited from class java.lang.Object
`getClass, notify, notifyAll, wait, wait, wait`

Methods inherited from interface java.util.Map
`equals, hashCode`

Constructor Detail

### UrlEncoded

    public UrlEncoded(UrlEncoded url)

### UrlEncoded

    public UrlEncoded()

### UrlEncoded

    public UrlEncoded(java.lang.String s)

### UrlEncoded

    public UrlEncoded(java.lang.String s,
                      java.lang.String charset)

Method Detail

### decode

    public void decode(java.lang.String query)

### decode

    public void decode(java.lang.String query,
                       java.lang.String charset)

### encode

    public java.lang.String encode()

  Encode Hashtable with % encoding.

### encode

    public java.lang.String encode(java.lang.String charset)

  Encode Hashtable with % encoding.

### encode

    public java.lang.String encode(java.lang.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=".

### decodeTo

    public static void decodeTo(java.lang.String content,
                                MultiMap map)

### decodeTo

    public static void decodeTo(java.lang.String content,
                                MultiMap map,
                                java.lang.String charset)

  Decoded parameters to Map.

  Parameters:
    `content` - the string containing the encoded parameters

### decodeTo

    public static void decodeTo(byte[] data,
                                int offset,
                                int length,
                                MultiMap map,
                                java.lang.String charset)

  Decoded parameters to Map.

  Parameters:
    `data` - the byte[] containing the encoded parameters

### decodeString

    public static java.lang.String decodeString(java.lang.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 java.lang.String decodeString(java.lang.String encoded,
                                                java.lang.String charset)

  Decode String with % encoding. This method makes the assumption that the majority of calls will need no decoding.

### decodeString

    public static java.lang.String decodeString(java.lang.String encoded,
                                                int offset,
                                                int length,
                                                java.lang.String charset)

  Decode String with % encoding. This method makes the assumption that the majority of calls will need no decoding.

### encodeString

    public static java.lang.String encodeString(java.lang.String string)

  Perform URL encoding. Assumes 8859 charset

  Parameters:
    `string` -
  Returns:
    encoded string.

### encodeString

    public static java.lang.String encodeString(java.lang.String string,
                                                java.lang.String charset)

  Perform URL encoding.

  Parameters:
    `string` -
  Returns:
    encoded string.

### clone

    public java.lang.Object clone()

  Overrides:
    `clone` in class `MultiMap`

Copyright © 2000 Mortbay Consulting Pty. Ltd. All Rights Reserved.