Class Util


  • public class Util
    extends Object

    Utilities in support of tag-handler classes.

    Author:
    Jan Luehe
    • Field Detail

      • specialCharactersRepresentation

        public static char[][] specialCharactersRepresentation
    • Constructor Detail

      • Util

        public Util()
    • Method Detail

      • getScope

        public static int getScope​(String scope)
      • getStyle

        public static int getStyle​(String style,
                                   String errCode)
                            throws jakarta.servlet.jsp.JspException
        Throws:
        jakarta.servlet.jsp.JspException
      • escapeXml

        public static String escapeXml​(String buffer)
        Performs the following substring replacements (to facilitate output to XML/HTML pages): & -> &amp; < -> &lt; > -> &gt; " -> &#034; ' -> &#039; See also OutSupport.writeEscapedXml().
      • getContentTypeAttribute

        public static String getContentTypeAttribute​(String input,
                                                     String name)
        Get the value associated with a content-type attribute. Syntax defined in RFC 2045, section 5.1.
      • URLEncode

        public static String URLEncode​(String s,
                                       String enc)
        URL encodes a string, based on the supplied character encoding. This performs the same function as java.next.URLEncode.encode in J2SDK1.4, and should be removed if the only platform supported is 1.4 or higher.
        Parameters:
        s - The String to be URL encoded.
        enc - The character encoding
        Returns:
        The URL encoded String [taken from jakarta-tomcat-jasper/jasper2 org.apache.jasper.runtime.JspRuntimeLibrary.java]
      • getRequestLocales

        public static Enumeration getRequestLocales​(jakarta.servlet.http.HttpServletRequest request)
        HttpServletRequest.getLocales() returns the server's default locale if the request did not specify a preferred language. We do not want this behavior, because it prevents us from using the fallback locale. We therefore need to return an empty Enumeration if no preferred locale has been specified. This way, the logic for the fallback locale will be able to kick in.