UrlEncoded (Jetty :: Aggregate :: All core Jetty 7.6.8.v20121106 API)
Date: 2012-11-06

org.eclipse.jetty.util

## Class UrlEncoded

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

- All Implemented Interfaces:
    Serializable, Cloneable, ConcurrentMap, Map

      public class UrlEncoded
      extends MultiMap
      implements 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 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

      `Map.Entry<K,V>`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `ENCODING`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `UrlEncoded()`
    `UrlEncoded(String s)`
    `UrlEncoded(String s, String charset)`
    `UrlEncoded(UrlEncoded url)`

  - ### Method Summary

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

    - ### 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 String ENCODING

  - ### Constructor Detail

    - #### UrlEncoded

          public UrlEncoded(UrlEncoded url)

    - #### UrlEncoded

          public UrlEncoded()

    - #### UrlEncoded

          public UrlEncoded(String s)

    - #### UrlEncoded

          public UrlEncoded(String s,
                    String charset)

  - ### Method Detail

    - #### decode

          public void decode(String query)

    - #### decode

          public void decode(String query,
                    String charset)

    - #### 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.
      Parameters:
        `equalsForNullValue` - if True, then an '=' is always used, even for parameters without a value. e.g. "blah?a=&b=&c=".

    - #### encode

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

      Decoded parameters to Map.
      Parameters:
        `content` - the string containing the encoded parameters

    - #### decodeTo

          public static void decodeTo(String content,
                      MultiMap map,
                      String charset,
                      int maxKeys)

      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(InputStream in,
                           MultiMap map,
                           int maxLength,
                           int maxKeys)
                                    throws IOException

      Decoded parameters to Map.
      Parameters:
        `in` - InputSteam to read
        `map` - MultiMap to add parameters to
        `maxLength` - maximum number of keys to read or -1 for no limit
      Throws:
        `IOException`

    - #### decodeUtf8To

          public static void decodeUtf8To(InputStream in,
                          MultiMap map,
                          int maxLength,
                          int maxKeys)
                                   throws IOException

      Decoded parameters to Map.
      Parameters:
        `in` - InputSteam to read
        `map` - MultiMap to add parameters to
        `maxLength` - maximum number of keys to read or -1 for no limit
      Throws:
        `IOException`

    - #### decodeUtf16To

          public static void decodeUtf16To(InputStream in,
                           MultiMap map,
                           int maxLength,
                           int maxKeys)
                                    throws IOException

      Throws:
        `IOException`

    - #### decodeTo

          public static void decodeTo(InputStream in,
                      MultiMap map,
                      String charset,
                      int maxLength,
                      int maxKeys)
                               throws IOException

      Decoded parameters to Map.
      Parameters:
        `in` - the stream containing the encoded parameters
      Throws:
        `IOException`

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

    - #### encodeString

          public static String encodeString(String string)

      Perform URL encoding.
      Parameters:
        `string` -
      Returns:
        encoded string.

    - #### encodeString

          public static String encodeString(String string,
                            String charset)

      Perform URL encoding.
      Parameters:
        `string` -
      Returns:
        encoded string.

    - #### clone

          public Object clone()

      Overrides:
        `clone` in class `Object`

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