public abstract class HtmlEscapingAwareTag extends RequestContextAwareTag
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 an application-wide default (the "defaultHtmlEscape"
context-param in web.xml
) is used.
setHtmlEscape(boolean)
,
HtmlEscapeTag
,
RequestContext.isDefaultHtmlEscape()
,
WebUtils.getDefaultHtmlEscape(javax.servlet.ServletContext)
,
WebUtils.getResponseEncodedHtmlEscape(javax.servlet.ServletContext)
,
Serialized Formlogger, REQUEST_CONTEXT_PAGE_ATTRIBUTE
id, pageContext
EVAL_BODY_AGAIN
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
Constructor and Description |
---|
HtmlEscapingAwareTag() |
Modifier and Type | Method and Description |
---|---|
protected String |
htmlEscape(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.
|
protected boolean |
isResponseEncodedHtmlEscape()
Return the applicable default for the use of response encoding with
HTML escaping for this tag.
|
void |
setHtmlEscape(boolean htmlEscape)
Set HTML escaping for this tag, as boolean value.
|
doCatch, doFinally, doStartTag, doStartTagInternal, getRequestContext
doAfterBody, doEndTag, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue
public void setHtmlEscape(boolean htmlEscape) throws JspException
JspException
HtmlEscapeTag.setDefaultHtmlEscape(boolean)
protected boolean isHtmlEscape()
isDefaultHtmlEscape()
protected boolean isDefaultHtmlEscape()
The default implementation checks the RequestContext's setting,
falling back to false
in case of no explicit default given.
protected boolean isResponseEncodedHtmlEscape()
The default implementation checks the RequestContext's setting,
falling back to false
in case of no explicit default given.
RequestContextAwareTag.getRequestContext()
protected String htmlEscape(String content)
The response encoding will be taken into account if the "responseEncodedHtmlEscape" setting is enabled as well.
content
- the String to escapeisHtmlEscape()
,
isResponseEncodedHtmlEscape()