Package org.jivesoftware.admin
Class JSTLFunctions
java.lang.Object
org.jivesoftware.admin.JSTLFunctions
Utility functions that are exposed through a taglib.
- Author:
- Guus der Kinderen
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringbyteFormat(long bytes) A formatter for formatting byte sizes.static StringescapeHTMLTags(String string) This method takes a string which may contain HTML tags (ie, <b>, <table>, etc) and converts the '<' and '>' characters to their HTML escape sequences.static StringreplaceAll(String string, String regex, String replacement) JSTL delegate forString.replaceAll(String, String).static String[]JSTL delegate forString.split(String).static StringDecodes aapplication/x-www-form-urlencodedstring using the UTF-8 encoding scheme.static StringTranslates a string intoapplication/x-www-form-urlencodedformat using a specific encoding scheme.
-
Constructor Details
-
JSTLFunctions
public JSTLFunctions()
-
-
Method Details
-
replaceAll
JSTL delegate forString.replaceAll(String, String). The first argument is the value on which the replacement has to occur. The other arguments are passed toString.replaceAll(String, String)directly.- Parameters:
string- The string to searchregex- the regular expression to which this string is to be matchedreplacement- the string to be substituted for each match- Returns:
- the updated string
- See Also:
-
split
JSTL delegate forString.split(String). The first argument is the value on which the replacement has to occur. The other argument is used as the argument for the invocation ofString.split(String).- Parameters:
string- The string to splitregex- the delimiting regular expression- Returns:
- the array of strings computed by splitting this string around matches of the given regular expression
- See Also:
-
byteFormat
A formatter for formatting byte sizes. For example, formatting 12345 byes results in "12.1 K" and 1234567 results in "1.18 MB".- Parameters:
bytes- the number of bytes- Returns:
- the number of bytes in terms of KB, MB, etc.
- See Also:
-
urlEncode
Translates a string intoapplication/x-www-form-urlencodedformat using a specific encoding scheme. This method uses the UTF-8 encoding scheme to obtain the bytes for unsafe characters.- Parameters:
string- the URL to encode- Returns:
- the encoded URL
- See Also:
-
urlDecode
Decodes aapplication/x-www-form-urlencodedstring using the UTF-8 encoding scheme. The encoding is used to determine what characters are represented by any consecutive sequences of the form "%xy".- Parameters:
string- the String to encode- Returns:
- the encoded string
- See Also:
-
escapeHTMLTags
This method takes a string which may contain HTML tags (ie, <b>, <table>, etc) and converts the '<' and '>' characters to their HTML escape sequences. It will also replace LF with <br>.- Parameters:
string- the String to escape- Returns:
- the escaped string
- See Also:
-