AttributeParser (Apache Tomcat 7.0.104 API Documentation)

org.apache.jasper.compiler

## Class AttributeParser

- java.lang.Object
- - org.apache.jasper.compiler.AttributeParser

-     public class AttributeParser
      extends Object

  Converts a JSP attribute value into the unquoted equivalent. The attribute may contain EL expressions, in which case care needs to be taken to avoid any ambiguities. For example, consider the attribute values "${1+1}" and "\${1+1}". After unquoting, both appear as "${1+1}" but the first should evaluate to "2" and the second to "${1+1}". Literal \, $ and # need special treatment to ensure there is no ambiguity. The JSP attribute unquoting covers \\, \", \', \$, \#, %\>, <\%, &apos; and &quot;

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static String` | `getUnquoted(String input, char quote, boolean isELIgnored, boolean isDeferredSyntaxAllowedAsLiteral, boolean quoteAttributeEL)` Parses the provided input String as a JSP attribute and returns an unquoted value.
    `protected static String` | `getUnquoted(String input, char quote, boolean isELIgnored, boolean isDeferredSyntaxAllowedAsLiteral, boolean strict, boolean quoteAttributeEL)` Provided solely for unit test purposes and allows per call overriding of the STRICT_QUOTE_ESCAPING system property.

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

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

- - ### Method Detail

    - #### getUnquoted

          public static String getUnquoted(String input,
                           char quote,
                           boolean isELIgnored,
                           boolean isDeferredSyntaxAllowedAsLiteral,
                           boolean quoteAttributeEL)

      Parses the provided input String as a JSP attribute and returns an unquoted value.
      Parameters:
        `input` - The input.
        `quote` - The quote character for the attribute or 0 for scripting expressions.
        `isELIgnored` - Is expression language being ignored on the page where the JSP attribute is defined.
        `isDeferredSyntaxAllowedAsLiteral` - Are deferred expressions treated as literals?
        `quoteAttributeEL` - Should the rules of JSP.1.6 for escaping in attributes be applied to EL in attribute values?
      Returns:
        An unquoted JSP attribute that, if it contains expression language can be safely passed to the EL processor without fear of ambiguity.

    - #### getUnquoted

          protected static String getUnquoted(String input,
                           char quote,
                           boolean isELIgnored,
                           boolean isDeferredSyntaxAllowedAsLiteral,
                           boolean strict,
                           boolean quoteAttributeEL)

      Provided solely for unit test purposes and allows per call overriding of the STRICT_QUOTE_ESCAPING system property.
      Parameters:
        `input` - The input.
        `quote` - The quote character for the attribute or 0 for scripting expressions.
        `isELIgnored` - Is expression language being ignored on the page where the JSP attribute is defined.
        `isDeferredSyntaxAllowedAsLiteral` - Are deferred expressions treated as literals?
        `strict` - The value to use for STRICT_QUOTE_ESCAPING.
        `quoteAttributeEL` - Should the rules of JSP.1.6 for escaping in attributes be applied to EL in attribute values?
      Returns:
        An unquoted JSP attribute that, if it contains expression language can be safely passed to the EL processor without fear of ambiguity.

Copyright © 2000-2020 Apache Software Foundation. All Rights Reserved.