org.apache.tapestry.util
Class ScriptUtils

java.lang.Object
  extended by org.apache.tapestry.util.ScriptUtils

public final class ScriptUtils
extends Object

Various scripting utility methods.


Field Summary
static String BEGIN_COMMENT
          XML cdata start.
static String END_COMMENT
          XML character data end.
static String SCRIPT_PATTERN
          Regexp represenging javascript matches.
 
Method Summary
static String ensureValidScriptTags(String input)
          Takes any <script>contents..</script> tags found in the specified input string and replaces their contents into one large <script></script> block (meaning if multiple script blocks are found, they will be turned into one), with the addition of BEGIN_COMMENT inserted before the logic block and END_COMMENT inserted after the logic block.
static String functionHash(Object target)
          Utility that will attempt to generate a unique hash string that is javascript client in a function name based on the inomcing object's Object.hashCode() return value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BEGIN_COMMENT

public static final String BEGIN_COMMENT
XML cdata start.

See Also:
Constant Field Values

END_COMMENT

public static final String END_COMMENT
XML character data end.

See Also:
Constant Field Values

SCRIPT_PATTERN

public static final String SCRIPT_PATTERN
Regexp represenging javascript matches.

See Also:
Constant Field Values
Method Detail

ensureValidScriptTags

public static String ensureValidScriptTags(String input)
Takes any <script>contents..</script> tags found in the specified input string and replaces their contents into one large <script></script> block (meaning if multiple script blocks are found, they will be turned into one), with the addition of BEGIN_COMMENT inserted before the logic block and END_COMMENT inserted after the logic block.

Parameters:
input - The string to replace tags on
Returns:
The properly formatted string, if any formatting needed to occur.

functionHash

public static String functionHash(Object target)
Utility that will attempt to generate a unique hash string that is javascript client in a function name based on the inomcing object's Object.hashCode() return value.

Parameters:
target - The object to hash a string for.
Returns:
A string hash value, not necessarily exactly the same thing that would be returned by Object.hashCode().


Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.