org.apache.beehive.netui.tags
Class HtmlUtils

Object
  extended by HtmlUtils

public class HtmlUtils
extends Object

This class provides a set of static methods that provide HTML utility code.


Constructor Summary
HtmlUtils()
           
 
Method Summary
static String addParams(String url, Map params, String encoding)
          Add parameters contained in the givem Map to the URL.
static boolean containsEntity(String value)
          Determine if the given value contains an HTML entity.
static boolean containsHtml(String value)
          Detect simple HTML contained inside of the given value string.
static String escapeEscapes(String value)
          Escape the escapes (") and (\\) with escapes.
static void filter(String value, AbstractRenderAppender result)
          Filter the specified value for characters that are sensitive to HTML interpreters.
static void filter(String value, AbstractRenderAppender result, boolean markupHTMLSpaceReturn)
          Filter the specified string for characters that are sensitive to HTML interpreters, returning the string with these characters replaced by the corresponding character entities.
static String legacyEscapeEscapes(String value)
          Deprecated. use escapeEscapes(String) instead
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HtmlUtils

public HtmlUtils()
Method Detail

containsHtml

public static boolean containsHtml(String value)
Detect simple HTML contained inside of the given value string.

Parameters:
value - the value
Returns:
true if the string contains HTML; false otherwise.

filter

public static void filter(String value,
                          AbstractRenderAppender result)
Filter the specified value for characters that are sensitive to HTML interpreters. It will return a string with these characters replaced with HTML entities. This method calls the overloaded method with markupHTMLSpaceReturn set to false.

Parameters:
value - The String value to be filtered and returned.
result - the AbstractRenderAppender to which the results should be rendered

filter

public static void filter(String value,
                          AbstractRenderAppender result,
                          boolean markupHTMLSpaceReturn)
Filter the specified string for characters that are sensitive to HTML interpreters, returning the string with these characters replaced by the corresponding character entities.

Parameters:
value - The String value to be filtered and returned.
markupHTMLSpaceReturn - convert space characters and return characters to &nbsp; and <br /> marketup for html.
result - the AbstractRenderAppender to which the results should be rendered

escapeEscapes

public static String escapeEscapes(String value)
Escape the escapes (") and (\\) with escapes. These characters will be replaced with (") and (\\\\) respectively.

Parameters:
value - the string to escape
Returns:
the escaped string

legacyEscapeEscapes

public static String legacyEscapeEscapes(String value)
Deprecated. use escapeEscapes(String) instead

Deprecated method using an old algorithm to escape escapes.

Parameters:
value - the value
Returns:
the escaped value

addParams

public static String addParams(String url,
                               Map params,
                               String encoding)
                        throws JspException
Add parameters contained in the givem Map to the URL. This method can handle values of type String, String array, null, and Object contained in the Map. If the type is an array, each of the items in the array will be added in-order onto the URL. Objects in the array will be added to the URL after calling Object.toString().

Parameters:
url - the base URL
params - the parameters to add to the URL
encoding - the encoding to use when encoding parameters onto the URL
Returns:
the URL created by adding the parameters onto the base URL string
Throws:
JspException

containsEntity

public static boolean containsEntity(String value)
Determine if the given value contains an HTML entity.

Parameters:
value - the value to check for an entity
Returns:
true if the value contains an entity; false otherwise.