org.wikimodel.wem
Class WikiPageUtil

java.lang.Object
  extended by org.wikimodel.wem.WikiPageUtil

public class WikiPageUtil
extends java.lang.Object

This class contains some utility methods used for escaping xml strings as well as for encoding/decoding http parameters.

Author:
kotelnikov

Constructor Summary
WikiPageUtil()
           
 
Method Summary
static java.lang.String decodeHttpParams(java.lang.String str)
          Returns the decoded http string - all special symbols, replaced by replaced by the %[HEX HEX] sequence, where [HEX HEX] is the hexadecimal code of the escaped symbol will be restored to its original characters (see RFC-2616 http://www.w3.org/Protocols/rfc2616/).
static java.lang.String encodeHttpParams(java.lang.String str)
          Returns the encoded string - all special symbols will be replaced by %[HEX HEX] sequence, where [HEX HEX] is the hexadecimal code of the escaped symbol (see RFC-2616 http://www.w3.org/Protocols/rfc2616/rfc2616.html).
static java.lang.String escapeXmlAttribute(java.lang.String str)
          Returns the escaped attribute string.
static java.lang.String escapeXmlString(java.lang.String str)
          Returns the escaped string.
static java.lang.String escapeXmlString(java.lang.String str, boolean escapeQuots)
          Returns the escaped string.
static java.lang.String getCDATA(java.lang.String text)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WikiPageUtil

public WikiPageUtil()
Method Detail

decodeHttpParams

public static java.lang.String decodeHttpParams(java.lang.String str)
Returns the decoded http string - all special symbols, replaced by replaced by the %[HEX HEX] sequence, where [HEX HEX] is the hexadecimal code of the escaped symbol will be restored to its original characters (see RFC-2616 http://www.w3.org/Protocols/rfc2616/).

Parameters:
str - the string to decode
Returns:
the decoded string.

encodeHttpParams

public static java.lang.String encodeHttpParams(java.lang.String str)
Returns the encoded string - all special symbols will be replaced by %[HEX HEX] sequence, where [HEX HEX] is the hexadecimal code of the escaped symbol (see RFC-2616 http://www.w3.org/Protocols/rfc2616/rfc2616.html).

Parameters:
str - the string to encode
Returns:
the encoded string.

escapeXmlAttribute

public static java.lang.String escapeXmlAttribute(java.lang.String str)
Returns the escaped attribute string.

Parameters:
str - the string to escape
Returns:
the escaped string.

escapeXmlString

public static java.lang.String escapeXmlString(java.lang.String str)
Returns the escaped string.

Parameters:
str - the string to escape
Returns:
the escaped string.

escapeXmlString

public static java.lang.String escapeXmlString(java.lang.String str,
                                               boolean escapeQuots)
Returns the escaped string.

Parameters:
str - the string to escape
escapeQuots - if this flag is true then "'" and "\"" symbols also will be escaped
Returns:
the escaped string.

getCDATA

public static java.lang.String getCDATA(java.lang.String text)
Parameters:
text -
Returns:
CDATA block corresponding to the given text


Copyright © 2005-2010. All Rights Reserved.