Class JSTLFunctions

java.lang.Object
org.jivesoftware.admin.JSTLFunctions

public class JSTLFunctions extends Object
Utility functions that are exposed through a taglib.
Author:
Guus der Kinderen
  • Constructor Details

    • JSTLFunctions

      public JSTLFunctions()
  • Method Details

    • replaceAll

      public static String replaceAll(String string, String regex, String replacement)
      JSTL delegate for String.replaceAll(String, String). The first argument is the value on which the replacement has to occur. The other arguments are passed to String.replaceAll(String, String) directly.
      Parameters:
      string - The string to search
      regex - the regular expression to which this string is to be matched
      replacement - the string to be substituted for each match
      Returns:
      the updated string
      See Also:
    • split

      public static String[] split(String string, String regex)
      JSTL delegate for String.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 of String.split(String).
      Parameters:
      string - The string to split
      regex - the delimiting regular expression
      Returns:
      the array of strings computed by splitting this string around matches of the given regular expression
      See Also:
    • byteFormat

      public static String byteFormat(long bytes)
      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

      public static String urlEncode(String string)
      Translates a string into application/x-www-form-urlencoded format 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

      public static String urlDecode(String string)
      Decodes a application/x-www-form-urlencoded string 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

      public static String escapeHTMLTags(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. It will also replace LF with <br>.
      Parameters:
      string - the String to escape
      Returns:
      the escaped string
      See Also: