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.apache.struts2.util.tomcat.buf
Class UDecoder

    java.lang.Object
      org.apache.struts2.util.tomcat.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
`static boolean` | `ALLOW_ENCODED_SLASH`

Constructor Summary
`UDecoder()`

Method Summary
`void` | `convert(ByteChunk mb, boolean query)` URLDecode, will modify the source.
`void` | `convert(CharChunk mb, boolean query)` In-buffer processing - the buffer will be modified
`void` | `convert(MessageBytes mb, boolean query)` URLDecode, will modify the source
`String` | `convert(String str, boolean query)`
`static String` | `URLDecode(byte[] bytes, String enc, boolean isQuery)` Decode and return the specified URL-encoded byte array.
`static String` | `URLDecode(String str)` Decode and return the specified URL-encoded String.
`static String` | `URLDecode(String str, String enc)` Decode and return the specified URL-encoded String.
`static String` | `URLDecode(String str, String enc, boolean isQuery)` 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

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

  URLDecode, will modify the source.

  Throws:
    `IOException`

### convert

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

  In-buffer processing - the buffer will be modified

  Throws:
    `IOException`

### convert

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

  URLDecode, will modify the source

  Throws:
    `IOException`

### convert

    public final String convert(String str,
                                boolean query)

### URLDecode

    public static String URLDecode(String str)

  Decode and return the specified URL-encoded String. When the byte array is converted to a string, the system default character encoding 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
  Throws:
    `IllegalArgumentException` - if a '%' character is not followed by a valid 2-digit hexadecimal number

### URLDecode

    public static String URLDecode(String str,
                                   String enc)

  Decode and return the specified URL-encoded String. It is assumed the string is not a query string.

  Parameters:
    `str` - The url-encoded string
    `enc` - The encoding to use; if null, the default encoding is used. If an unsupported encoding is specified null will be returned
  Throws:
    `IllegalArgumentException` - if a '%' character is not followed by a valid 2-digit hexadecimal number

### URLDecode

    public static String URLDecode(String str,
                                   String enc,
                                   boolean isQuery)

  Decode and return the specified URL-encoded String.

  Parameters:
    `str` - The url-encoded string
    `enc` - The encoding to use; if null, the default encoding is used. If an unsupported encoding is specified null will be returned
    `isQuery` - Is this a query string being processed
  Throws:
    `IllegalArgumentException` - if a '%' character is not followed by a valid 2-digit hexadecimal number

### URLDecode

    public static String URLDecode(byte[] bytes,
                                   String enc,
                                   boolean isQuery)

  Decode and return the specified URL-encoded byte array.

  Parameters:
    `bytes` - The url-encoded byte array
    `enc` - The encoding to use; if null, the default encoding is used. If an unsupported encoding is specified null will be returned
    `isQuery` - Is this a query string being processed
  Throws:
    `IllegalArgumentException` - if a '%' character is not followed by a valid 2-digit hexadecimal number

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 © 2000–2017 Apache Software Foundation. All rights reserved.