org.apache.naming
Class Util

java.lang.Object
  extended by org.apache.naming.Util

public final class Util
extends java.lang.Object

Utility methods originally defined in org.apache.catalina.util.RequestUtil and moved here in order to become accessible to code in web-naming and war-util.


Constructor Summary
Util()
           
 
Method Summary
static byte convertHexDigit(byte b)
          Convert a byte character value to hexidecimal digit value.
static java.lang.String normalize(java.lang.String path, boolean replaceBackSlash)
          Normalize a relative URI path that may have relative values ("/./", "/../", and so on ) it it.
static java.lang.String urlDecode(byte[] bytes)
          Decode and return the specified URL-encoded byte array.
static java.lang.String urlDecode(byte[] bytes, java.lang.String enc)
          Decode and return the specified URL-encoded byte array.
static java.lang.String urlDecode(java.lang.String str)
          Decode and return the specified URL-encoded String.
static java.lang.String urlDecode(java.lang.String str, java.lang.String enc)
          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
 

Constructor Detail

Util

public Util()
Method Detail

normalize

public static java.lang.String normalize(java.lang.String path,
                                         boolean replaceBackSlash)
Normalize a relative URI path that may have relative values ("/./", "/../", and so on ) it it. WARNING - This method is useful only for normalizing application-generated paths. It does not try to perform security checks for malicious input.

Parameters:
path - Relative path to be normalized
replaceBackSlash - Should '\\' be replaced with '/'

urlDecode

public static java.lang.String urlDecode(java.lang.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.

Parameters:
str - The url-encoded string
Throws:
java.lang.IllegalArgumentException - if a '%' character is not followed by a valid 2-digit hexadecimal number

urlDecode

public static java.lang.String urlDecode(java.lang.String str,
                                         java.lang.String enc)
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
Throws:
java.lang.IllegalArgumentException - if a '%' character is not followed by a valid 2-digit hexadecimal number

urlDecode

public static java.lang.String urlDecode(byte[] bytes)
Decode and return the specified URL-encoded byte array.

Parameters:
bytes - The url-encoded byte array
Throws:
java.lang.IllegalArgumentException - if a '%' character is not followed by a valid 2-digit hexadecimal number

urlDecode

public static java.lang.String urlDecode(byte[] bytes,
                                         java.lang.String enc)
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
Throws:
java.lang.IllegalArgumentException - if a '%' character is not followed by a valid 2-digit hexadecimal number

convertHexDigit

public static byte convertHexDigit(byte b)
Convert a byte character value to hexidecimal digit value.

Parameters:
b - the character value byte


Copyright © 2012 GlassFish Community. All Rights Reserved.