org.apache.struts2.jasper.tagplugins.jstl

## Class Util

- java.lang.Object
- - org.apache.struts2.jasper.tagplugins.jstl.Util

-     public class Util
      extends Object

  Util contains some often used consts, static methods and embedded class to support the JSTL tag plugin.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `Util.ImportResponseWrapper` Wraps responses to allow us to retrieve results as Strings.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `DEFAULT_ENCODING`
    `static int` | `HIGHEST_SPECIAL`
    `static char[][]` | `specialCharactersRepresentation`
    `static String` | `VALID_SCHEME_CHAR`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Util()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static String` | `escapeXml(String buffer)` Performs the following substring replacements (to facilitate output to XML/HTML pages):
    `static String` | `getContentTypeAttribute(String input, String name)`
    `static int` | `getScope(String scope)` Converts the given string description of a scope to the corresponding PageContext constant.
    `static boolean` | `isAbsoluteUrl(String url)`
    `static String` | `resolveUrl(String url, String context, javax.servlet.jsp.PageContext pageContext)` Utility methods taken from org.apache.taglibs.standard.tag.common.core.UrlSupport
    `static String` | `stripSession(String url)` Strips a servlet session ID from `url`.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### VALID_SCHEME_CHAR

          public static final String VALID_SCHEME_CHAR

      See Also:
        Constant Field Values

    - #### DEFAULT_ENCODING

          public static final String DEFAULT_ENCODING

      See Also:
        Constant Field Values

    - #### HIGHEST_SPECIAL

          public static final int HIGHEST_SPECIAL

      See Also:
        Constant Field Values

    - #### specialCharactersRepresentation

          public static char[][] specialCharactersRepresentation

  - ### Constructor Detail

    - #### Util

          public Util()

  - ### Method Detail

    - #### getScope

          public static int getScope(String scope)

      Converts the given string description of a scope to the corresponding PageContext constant. The validity of the given scope has already been checked by the appropriate TLV.
      Parameters:
        `scope` - String description of scope
      Returns:
        PageContext constant corresponding to given scope description taken from org.apache.taglibs.standard.tag.common.core.Util

    - #### isAbsoluteUrl

          public static boolean isAbsoluteUrl(String url)

      Parameters:
        `url` - the URL
      Returns:
        `true` if our current URL is absolute, `false` otherwise. taken from org.apache.taglibs.standard.tag.common.core.ImportSupport

    - #### getContentTypeAttribute

          public static String getContentTypeAttribute(String input,
                                                       String name)

      Parameters:
        `input` - input string
        `name` - name of attribute
      Returns:
        the value associated with a content-type attribute. Syntax defined in RFC 2045, section 5.1. taken from org.apache.taglibs.standard.tag.common.core.Util

    - #### stripSession

          public static String stripSession(String url)

      Strips a servlet session ID from `url`. The session ID is encoded as a URL "path parameter" beginning with "jsessionid=". We thus remove anything we find between ";jsessionid=" (inclusive) and either EOS or a subsequent ';' (exclusive). taken from org.apache.taglibs.standard.tag.common.core.ImportSupport
      Parameters:
        `url` - the URL
      Returns:
        servlet session ID from URL

    - #### 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(). taken from org.apache.taglibs.standard.tag.common.core.Util
      Parameters:
        `buffer` - string
      Returns:
        escaped string

    - #### resolveUrl

          public static String resolveUrl(String url,
                                          String context,
                                          javax.servlet.jsp.PageContext pageContext)
                                   throws javax.servlet.jsp.JspException

      Utility methods taken from org.apache.taglibs.standard.tag.common.core.UrlSupport
      Parameters:
        `url` - URL
        `context` - context
        `pageContext` - page context
      Returns:
        the URL
      Throws:
        `javax.servlet.jsp.JspException` - in case of errors

Copyright © 2000–2025 Apache Software Foundation. All rights reserved.