atg.rest.client
Class RestClientUtils

java.lang.Object
  extended by atg.rest.client.RestClientUtils

public class RestClientUtils
extends java.lang.Object

Utility methods for the Rest client classes.

See Also:
Exception

Field Summary
static java.lang.String CLASS_VERSION
          Class version string
protected static java.lang.String NUM_CHAR_REF_END
           
protected static java.lang.String NUM_CHAR_REF_START
           
static java.util.regex.Pattern RESERVED_URI_CHARS
           
 
Constructor Summary
RestClientUtils()
           
 
Method Summary
static boolean containsNumCharRefs(java.lang.String pVal)
          Checks to see if a string contains any numeric character references of the form &#N; where N is either a decimal or hexidecimal value of a character's unicode code point.
static boolean isBlank(java.lang.String pStr)
          Return true if pStr is null, the empty string, or consists entirely of whitespace where whitespace is defined by the String.trim method.
static java.lang.String numCharRefToUnicode(java.lang.String pVal)
          Converts any unicode values in a string encoded as numeric character references into their literal unicode character values.
static java.lang.String urlEncodeDisallowedOnly(java.lang.String pUrl)
          performs a percent-encoding on only the disallowed characters in a URL.
static java.lang.String urlToPunycode(java.lang.String pURL)
          converts a url containing literal unicode characters, or numeric character references into punycode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string


NUM_CHAR_REF_START

protected static final java.lang.String NUM_CHAR_REF_START
See Also:
Constant Field Values

NUM_CHAR_REF_END

protected static final java.lang.String NUM_CHAR_REF_END
See Also:
Constant Field Values

RESERVED_URI_CHARS

public static java.util.regex.Pattern RESERVED_URI_CHARS
Constructor Detail

RestClientUtils

public RestClientUtils()
Method Detail

isBlank

public static boolean isBlank(java.lang.String pStr)
Return true if pStr is null, the empty string, or consists entirely of whitespace where whitespace is defined by the String.trim method.


urlToPunycode

public static java.lang.String urlToPunycode(java.lang.String pURL)
converts a url containing literal unicode characters, or numeric character references into punycode

Parameters:
pURL - the url to transform
Returns:
the url as punycode, if any characeters needed to be encoded, or pURL if there were no non-ASCII characters in pURL

urlEncodeDisallowedOnly

public static java.lang.String urlEncodeDisallowedOnly(java.lang.String pUrl)
                                                throws java.io.UnsupportedEncodingException
performs a percent-encoding on only the disallowed characters in a URL. does not alter reserved or non-reserved characeters.

Parameters:
pUrl - a URL to be percent encoded
Returns:
the resulting URL after percent encoding has been performed on only the disallowed characters.
Throws:
java.io.UnsupportedEncodingException - if the UTF-8 encoding is not supported

numCharRefToUnicode

public static java.lang.String numCharRefToUnicode(java.lang.String pVal)
Converts any unicode values in a string encoded as numeric character references into their literal unicode character values. A unicode value encoded as a numeric character reference takes the form of &#N; where N is either the decimal or hexidecimal value of a character's unicode code point. For instance, the numeric character reference of would be converted into the Korean Hangul Jamo character of choseong cieuc.

Parameters:
pVal - A string potentially containing numeric character references
Returns:
The string with any numeric character references converted to literal unicode characters, or if no numeric character references are present, then return pVal

containsNumCharRefs

public static boolean containsNumCharRefs(java.lang.String pVal)
Checks to see if a string contains any numeric character references of the form &#N; where N is either a decimal or hexidecimal value of a character's unicode code point.

Parameters:
pVal - the string to check
Returns:
true if pVal contains any numeric character references, false if not