gr.uoa.di.madgik.searchlibrary.operatorlibrary.google.util
Class EscapeCharacters

java.lang.Object
  extended by gr.uoa.di.madgik.searchlibrary.operatorlibrary.google.util.EscapeCharacters

public final class EscapeCharacters
extends Object

Convenience methods for escaping special characters related to HTML, XML, and regular expressions.

To keep you safe by default, WEB4J goes to some effort to escape characters in your data when appropriate, such that you usually don't need to think too much about escaping special characters. Thus, you shouldn't need to directly use the services of this class very often.

For Model Objects containing free form user input, it is highly recommended that you use SafeText, not String. Free form user input is open to malicious use, such as Cross Site Scripting attacks. Using SafeText will protect you from such attacks, by always escaping special characters automatically in its toString() method.

The following WEB4J classes will automatically escape special characters for you, when needed :


Method Summary
static String forHrefAmpersand(String aURL)
          Escape all ampersand characters in a URL.
static String forHTML(String aText)
          Escape characters for text appearing in HTML markup.
static String forRegex(String aRegexFragment)
          Replace characters having special meaning in regular expressions with their escaped equivalents, preceded by a '\' character.
static String forReplacementString(String aInput)
          Escape '$' and '\' characters in replacement strings.
static String forScriptTagsOnly(String aText)
          Disable all

Copyright © 2013. All Rights Reserved.