com.waveset.util
Class RFC2396URLPieceEncode

java.lang.Object
  extended bycom.waveset.util.RFC2396URLPieceEncode

public class RFC2396URLPieceEncode
extends java.lang.Object


Field Summary
static java.lang.String code_id
           
 
Constructor Summary
RFC2396URLPieceEncode()
           
 
Method Summary
static java.lang.String encode(java.lang.String s)
          Calls encode(String, String) with a null 'dontEncode' argument.
static java.lang.String encode(java.lang.String s, java.lang.String dontEncode)
          Calls encode(String, String, boolean) with a false 'encodeSpecial' argument.
static java.lang.String encode(java.lang.String s, java.lang.String dontEncode, boolean encodeSpecial)
          This method should be used to encode the pieces that are used to construct a URL.
static java.lang.String encodeSpecial(java.lang.String s)
          Calls encode(String, String, boolean) with a null 'dontEncode' argument and a true 'encodeSpecial' argument.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

code_id

public static final java.lang.String code_id
See Also:
Constant Field Values
Constructor Detail

RFC2396URLPieceEncode

public RFC2396URLPieceEncode()
Method Detail

encode

public static java.lang.String encode(java.lang.String s)
Calls encode(String, String) with a null 'dontEncode' argument.


encode

public static java.lang.String encode(java.lang.String s,
                                      java.lang.String dontEncode)
Calls encode(String, String, boolean) with a false 'encodeSpecial' argument.


encodeSpecial

public static java.lang.String encodeSpecial(java.lang.String s)
Calls encode(String, String, boolean) with a null 'dontEncode' argument and a true 'encodeSpecial' argument.


encode

public static java.lang.String encode(java.lang.String s,
                                      java.lang.String dontEncode,
                                      boolean encodeSpecial)

This method should be used to encode the pieces that are used to construct a URL. The encoding scheme is that documented in RFC 2396. The following characters are *not* encoded:

The following characters are considered special and are encoded or not based on the 'encodeSpecial' boolean argument:

In addition, any characters in the 'dontEncode' string argument are not encoded. All other characters are encoded into the 3-character string "%xy", where xy is the two-digit hexadecimal representation of the lower 8-bits of the character.

RFC 2396 specifies that the characters ;/?:@&=+,$ do not need to be encoded provided that they are used in the special meaning reserved for them in RFC 2396. This method can be used to encode the pieces of the URL that typically go between these characters in the resulting URL by setting 'encodeSpecial' to true. The 'dontEncode' argument allows this behavior to be overridden on a character by character basis, if needed.

Implementation Note: This method differs from java.net.URLEncoder.encode() in that this method encodes ' ' as '%20' instead of '+'.

Parameters:
s - - the string to be encoded.
dontEncode - - the string of characters that should not be encoded.
encodeSpecial - - whether or not the characters -_.!~*'() are encoded.
Returns:
the encoded string.