UDecoder (Apache Tomcat 7.0.103 API Documentation)

org.apache.tomcat.util.buf

## Class UDecoder

- java.lang.Object
- - org.apache.tomcat.util.buf.UDecoder

-     public final class UDecoder
      extends Object

  All URL decoding happens here. This way we can reuse, review, optimize without adding complexity to the buffers. The conversion will modify the original buffer.
  Author:
    Costin Manolache

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static boolean` | `ALLOW_ENCODED_SLASH`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `UDecoder()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `convert(ByteChunk mb)` Deprecated. Unused. Will be removed in Tomcat 8.0.x onwards.
    `void` | `convert(ByteChunk mb, boolean query)` URLDecode, will modify the source.
    `void` | `convert(CharChunk mb)` Deprecated. Unused. Will be removed in Tomcat 8.0.x onwards.
    `void` | `convert(CharChunk mb, boolean query)` In-buffer processing - the buffer will be modified.
    `void` | `convert(MessageBytes mb)` Deprecated. Unused. Will be removed in Tomcat 8.0.x onwards.
    `void` | `convert(MessageBytes mb, boolean query)` URLDecode, will modify the source
    `String` | `convert(String str)` Deprecated. Unused. Will be removed in Tomcat 8.0.x onwards.
    `String` | `convert(String str, boolean query)` %xx decoding of a string.
    `static String` | `URLDecode(String str)` Decode and return the specified URL-encoded String.
    `static String` | `URLDecode(String str, Charset charset)` Decode and return the specified URL-encoded String.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### ALLOW_ENCODED_SLASH

          public static final boolean ALLOW_ENCODED_SLASH

  - ### Constructor Detail

    - #### UDecoder

          public UDecoder()

  - ### Method Detail

    - #### convert

          @Deprecated
          public void convert(ByteChunk mb)
                       throws IOException

      Deprecated. Unused. Will be removed in Tomcat 8.0.x onwards.
      URLDecode, will modify the source.
      Parameters:
        `mb` - The URL encoded bytes
      Throws:
        `IOException` - Invalid %xx URL encoding

    - #### convert

          public void convert(ByteChunk mb,
                     boolean query)
                       throws IOException

      URLDecode, will modify the source.
      Parameters:
        `mb` - The URL encoded bytes
        `query` - `true` if this is a query string
      Throws:
        `IOException` - Invalid %xx URL encoding

    - #### convert

          @Deprecated
          public void convert(CharChunk mb)
                       throws IOException

      Deprecated. Unused. Will be removed in Tomcat 8.0.x onwards.
      In-buffer processing - the buffer will be modified.
      Parameters:
        `mb` - The URL encoded chars
      Throws:
        `IOException` - Invalid %xx URL encoding

    - #### convert

          public void convert(CharChunk mb,
                     boolean query)
                       throws IOException

      In-buffer processing - the buffer will be modified.
      Parameters:
        `mb` - The URL encoded chars
        `query` - `true` if this is a query string
      Throws:
        `IOException` - Invalid %xx URL encoding

    - #### convert

          @Deprecated
          public void convert(MessageBytes mb)
                       throws IOException

      Deprecated. Unused. Will be removed in Tomcat 8.0.x onwards.
      URLDecode, will modify the source Includes converting '+' to ' '.
      Parameters:
        `mb` - The URL encoded String, bytes or chars
      Throws:
        `IOException` - Invalid %xx URL encoding

    - #### convert

          public void convert(MessageBytes mb,
                     boolean query)
                       throws IOException

      URLDecode, will modify the source
      Parameters:
        `mb` - The URL encoded String, bytes or chars
        `query` - `true` if this is a query string
      Throws:
        `IOException` - Invalid %xx URL encoding

    - #### convert

          @Deprecated
          public final String convert(String str)

      Deprecated. Unused. Will be removed in Tomcat 8.0.x onwards.
      %xx decoding of a query string. FIXME: this is inefficient.
      Parameters:
        `str` - The URL encoded string
      Returns:
        the decoded string

    - #### convert

          public final String convert(String str,
                       boolean query)

      %xx decoding of a string. FIXME: this is inefficient.
      Parameters:
        `str` - The URL encoded string
        `query` - `true` if this is a query string
      Returns:
        the decoded string

    - #### URLDecode

          public static String URLDecode(String str)

      Decode and return the specified URL-encoded String. When the byte array is converted to a string, UTF-8 is used. This may be different than some other servers. It is assumed the string is not a query string.
      Parameters:
        `str` - The url-encoded string
      Returns:
        the decoded string
      Throws:
        `IllegalArgumentException` - if a '%' character is not followed by a valid 2-digit hexadecimal number

    - #### URLDecode

          public static String URLDecode(String str,
                         Charset charset)

      Decode and return the specified URL-encoded String. It is assumed the string is not a query string.
      Parameters:
        `str` - The url-encoded string
        `charset` - The character encoding to use; if null, UTF-8 is used.
      Returns:
        the decoded string
      Throws:
        `IllegalArgumentException` - if a '%' character is not followed by a valid 2-digit hexadecimal number

Copyright © 2000-2020 Apache Software Foundation. All Rights Reserved.