com.autonomy.utilities
Class HTTPUtils

java.lang.Object
  |
  +--com.autonomy.utilities.HTTPUtils

public class HTTPUtils
extends java.lang.Object

Library of functions specifically used for processing HTTP connections


Constructor Summary
HTTPUtils()
           
 
Method Summary
static boolean charNeedsURLEncoding(char c)
          Returns true if c should be URL Encoded, if it appears as part of a URL
static java.lang.String getURLContents(java.lang.String sURL)
          Download the contents of the given URL and store in a String
static java.lang.String URLDecode(java.lang.String sToDecode, java.lang.String sEncoding)
          A URL Unescaping function that works with non-ASCII characters on non-English locales
static java.lang.String URLEncode(java.lang.String sToEncode, java.lang.String sEncoding)
          A URL Escaping function that works with non-ASCII characters on non-English locales
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HTTPUtils

public HTTPUtils()
Method Detail

getURLContents

public static java.lang.String getURLContents(java.lang.String sURL)
Download the contents of the given URL and store in a String

Parameters:
sURL - URL to download
Returns:
contents of URL, as a String

URLEncode

public static java.lang.String URLEncode(java.lang.String sToEncode,
                                         java.lang.String sEncoding)
A URL Escaping function that works with non-ASCII characters on non-English locales

Parameters:
sToEncode - String to encode
sEncoding - String to represent encoding type
Returns:
URL Escaped string

charNeedsURLEncoding

public static boolean charNeedsURLEncoding(char c)
Returns true if c should be URL Encoded, if it appears as part of a URL


URLDecode

public static java.lang.String URLDecode(java.lang.String sToDecode,
                                         java.lang.String sEncoding)
                                  throws java.lang.Exception
A URL Unescaping function that works with non-ASCII characters on non-English locales

Parameters:
sToDecode - String to decode
sEncoding - String to represent encoding type
Returns:
URL Unescaped string
Throws:
java.lang.Exception - if encoding is invalid or sToDecode is not a valid URL escaped string