com.plumtree.openfoundation.web
Class XPHttpUtility

java.lang.Object
  extended bycom.plumtree.openfoundation.web.XPHttpUtility

public class XPHttpUtility
extends java.lang.Object

Contains static utility methods to encode strings for inclusion in HTML documents or URL strings, or decode such text.


Constructor Summary
XPHttpUtility()
           
 
Method Summary
static java.lang.String HtmlDecode(java.lang.String input)
          Returns a decoded version of the input string, assuming it was a valid HTML encoding.
static java.lang.String HtmlEncode(java.lang.String input)
          Returns an HTML-encoded version of the input string, or empty string if input is null.
static java.lang.String UrlDecode(java.lang.String input, java.lang.String encoding)
          Returns a decoded version of the input string, assuming it was a valid URL encoding.
static java.lang.String UrlEncode(java.lang.String input, java.lang.String encoding)
          Returns a URL-encoded version of the input string, or empty string if input is null.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XPHttpUtility

public XPHttpUtility()
Method Detail

HtmlEncode

public static java.lang.String HtmlEncode(java.lang.String input)
Returns an HTML-encoded version of the input string, or empty string if input is null.

Parameters:
input - a string of characters to encode for use as HTML text.
Returns:
an encoded version of the input, or empty string if null.

HtmlDecode

public static java.lang.String HtmlDecode(java.lang.String input)
                                   throws XPUnsupportedEncodingException
Returns a decoded version of the input string, assuming it was a valid HTML encoding.

Parameters:
input - the string to decode
Returns:
a decoded version of the input.
Throws:
XPNullPointerException - if input null
XPUnsupportedEncodingException - if invalid ampersand escape found

UrlEncode

public static java.lang.String UrlEncode(java.lang.String input,
                                         java.lang.String encoding)
                                  throws XPUnsupportedEncodingException
Returns a URL-encoded version of the input string, or empty string if input is null.

Parameters:
input - a string of characters to encode for use i.
encoding - type of encoding.
Returns:
an encoded version of the input, or empty string if null.
Throws:
XPUnsupportedEncodingException - if encoding fails.

UrlDecode

public static java.lang.String UrlDecode(java.lang.String input,
                                         java.lang.String encoding)
                                  throws XPUnsupportedEncodingException
Returns a decoded version of the input string, assuming it was a valid URL encoding. Performance improvements 4-Jul-2004, JosephS.

Parameters:
input - the string to decode
encoding - the encoding used to interpret the encoded bytes
Returns:
a decoded version of the input.
Throws:
XPNullPointerException - if input null
XPUnsupportedEncodingException - if invalid ampersand escape found


Copyright 2002, 2003, 2004 Plumtree Software Inc. All Rights Reserved.