Class HtmlEscapingAwareTag

  • All Implemented Interfaces:
    java.io.Serializable, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.Tag, javax.servlet.jsp.tagext.TryCatchFinally
    Direct Known Subclasses:
    EscapeBodyTag, EvalTag, MessageTag, TokenTag

    public abstract class HtmlEscapingAwareTag
    extends CurrentActivityAwareTag
    Superclass for tags that output content that might get HTML-escaped.

    Provides a "htmlEscape" property for explicitly specifying whether to apply HTML escaping. If not set, a page-level default (e.g. from the HtmlEscapeTag) or a setting value injected by Aspect (the "defaultHtmlEscape" setting name) is used.

    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from class javax.servlet.jsp.tagext.TagSupport

        id, pageContext
      • Fields inherited from interface javax.servlet.jsp.tagext.IterationTag

        EVAL_BODY_AGAIN
      • Fields inherited from interface javax.servlet.jsp.tagext.Tag

        EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.lang.String htmlEscape​(java.lang.String content)
      HTML-encodes the given String, only if the "htmlEscape" setting is enabled.
      protected boolean isDefaultHtmlEscape()
      Return the applicable default HTML escape setting for this tag.
      protected boolean isHtmlEscape()
      Return the HTML escaping setting for this tag, or the default setting if not overridden.
      void setHtmlEscape​(boolean htmlEscape)
      Set HTML escaping for this tag, as boolean value.
      • Methods inherited from class javax.servlet.jsp.tagext.TagSupport

        doAfterBody, doEndTag, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • HtmlEscapingAwareTag

        public HtmlEscapingAwareTag()
    • Method Detail

      • setHtmlEscape

        public void setHtmlEscape​(boolean htmlEscape)
        Set HTML escaping for this tag, as boolean value. Overrides the default HTML escaping setting for the current activity.
        See Also:
        HtmlEscapeTag.setDefaultHtmlEscape(boolean)
      • isHtmlEscape

        protected boolean isHtmlEscape()
        Return the HTML escaping setting for this tag, or the default setting if not overridden.
        See Also:
        isDefaultHtmlEscape()
      • isDefaultHtmlEscape

        protected boolean isDefaultHtmlEscape()
        Return the applicable default HTML escape setting for this tag.

        The default implementation checks the RequestContext's setting, falling back to false in case of no explicit default given.

      • htmlEscape

        protected java.lang.String htmlEscape​(java.lang.String content)
        HTML-encodes the given String, only if the "htmlEscape" setting is enabled.

        The response encoding will be taken into account if the "responseEncodedHtmlEscape" setting is enabled as well.

        Parameters:
        content - the String to escape
        Returns:
        the escaped String