Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.eclipse.jetty.util
Class UrlEncoded

    java.lang.Object
      org.eclipse.jetty.util.MultiMap
          org.eclipse.jetty.util.UrlEncoded

All Implemented Interfaces:
  java.io.Serializable, java.util.concurrent.ConcurrentMap, java.util.Map

    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 UTF-8 charset is assumed, unless otherwise defined by either passing a parameter or setting the "org.eclipse.jetty.util.UrlEncoding.charset" System property.

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.

See Also:
  `URLEncoder`, Serialized Form

Nested Class Summary

Nested classes/interfaces inherited from interface java.util.Map
`java.util.Map.Entry<K,V>`

Field Summary
`static java.lang.String` | `ENCODING`

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 void` | `decode88591To(java.io.InputStream in, MultiMap map, int maxLength)` Decoded parameters to Map.
`static java.lang.String` | `decodeString(java.lang.String encoded, int offset, int length, java.lang.String charset)` Decode String with % encoding.
`static void` | `decodeTo(java.io.InputStream in, MultiMap map, java.lang.String charset, int maxLength)` Decoded parameters to Map.
`static void` | `decodeTo(java.lang.String content, MultiMap map, java.lang.String charset)` Decoded parameters to Map.
`static void` | `decodeUtf16To(java.io.InputStream in, MultiMap map, int maxLength)`
`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(java.io.InputStream in, MultiMap map, int maxLength)` Decoded parameters to Map.
`java.lang.String` | `encode()` Encode Hashtable with % encoding.
`static java.lang.String` | `encode(MultiMap map, java.lang.String charset, boolean equalsForNullValue)` 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.eclipse.jetty.util.MultiMap
`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`

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

Field Detail

### ENCODING

    public static final java.lang.String ENCODING

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=".

### encode

    public static java.lang.String encode(MultiMap map,
                                          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,
                                java.lang.String charset)

  Decoded parameters to Map.

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

### decodeUtf8To

    public static void decodeUtf8To(byte[] raw,
                                    int offset,
                                    int length,
                                    MultiMap map)

  Decoded parameters to Map.

  Parameters:
    `raw` - the byte[] containing the encoded parameters
    `offset` - the offset within raw to decode from
    `length` - the length of the section to decode
    `map` - the `MultiMap` to populate

### decodeUtf8To

    public static void decodeUtf8To(byte[] raw,
                                    int offset,
                                    int length,
                                    MultiMap map,
                                    Utf8StringBuilder buffer)

  Decoded parameters to Map.

  Parameters:
    `raw` - the byte[] containing the encoded parameters
    `offset` - the offset within raw to decode from
    `length` - the length of the section to decode
    `map` - the `MultiMap` to populate
    `buffer` - the buffer to decode into

### decode88591To

    public static void decode88591To(java.io.InputStream in,
                                     MultiMap map,
                                     int maxLength)
                              throws java.io.IOException

  Decoded parameters to Map.

  Parameters:
    `in` - InputSteam to read
    `map` - MultiMap to add parameters to
    `maxLength` - maximum length of content to read 0r -1 for no limit
  Throws:
    `java.io.IOException`

### decodeUtf8To

    public static void decodeUtf8To(java.io.InputStream in,
                                    MultiMap map,
                                    int maxLength)
                             throws java.io.IOException

  Decoded parameters to Map.

  Parameters:
    `in` - InputSteam to read
    `map` - MultiMap to add parameters to
    `maxLength` - maximum length of content to read 0r -1 for no limit
  Throws:
    `java.io.IOException`

### decodeUtf16To

    public static void decodeUtf16To(java.io.InputStream in,
                                     MultiMap map,
                                     int maxLength)
                              throws java.io.IOException

  Throws:
    `java.io.IOException`

### decodeTo

    public static void decodeTo(java.io.InputStream in,
                                MultiMap map,
                                java.lang.String charset,
                                int maxLength)
                         throws java.io.IOException

  Decoded parameters to Map.

  Parameters:
    `in` - the stream containing the encoded parameters
  Throws:
    `java.io.IOException`

### 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.

  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 `java.lang.Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 1995-2010 Mort Bay Consulting. All Rights Reserved.