|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object TagSupport org.springframework.web.servlet.tags.RequestContextAwareTag org.springframework.web.servlet.tags.HtmlEscapingAwareTag org.springframework.web.servlet.tags.EscapeBodyTag
public class EscapeBodyTag
Custom JSP tag to escape its enclosed body content, applying HTML escaping and/or JavaScript escaping.
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.
Provides a "javaScriptEscape" property for specifying whether to apply JavaScript escaping. Can be combined with HTML escaping or used standalone.
HtmlUtils
,
JavaScriptUtils
Field Summary | |
---|---|
private BodyContent |
bodyContent
|
private boolean |
javaScriptEscape
|
Fields inherited from class org.springframework.web.servlet.tags.RequestContextAwareTag |
---|
logger, REQUEST_CONTEXT_PAGE_ATTRIBUTE |
Constructor Summary | |
---|---|
EscapeBodyTag()
|
Method Summary | |
---|---|
int |
doAfterBody()
|
void |
doInitBody()
|
protected int |
doStartTagInternal()
Called by doStartTag to perform the actual work. |
protected java.lang.String |
readBodyContent()
Read the unescaped body content from the page. |
void |
setBodyContent(BodyContent bodyContent)
|
void |
setJavaScriptEscape(java.lang.String javaScriptEscape)
Set JavaScript escaping for this tag, as boolean value. |
protected void |
writeBodyContent(java.lang.String content)
Write the escaped body content to the page. |
Methods inherited from class org.springframework.web.servlet.tags.HtmlEscapingAwareTag |
---|
isDefaultHtmlEscape, isHtmlEscape, setHtmlEscape |
Methods inherited from class org.springframework.web.servlet.tags.RequestContextAwareTag |
---|
doCatch, doFinally, doStartTag, getRequestContext |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private boolean javaScriptEscape
private BodyContent bodyContent
Constructor Detail |
---|
public EscapeBodyTag()
Method Detail |
---|
public void setJavaScriptEscape(java.lang.String javaScriptEscape) throws JspException
JspException
protected int doStartTagInternal()
RequestContextAwareTag
doStartTagInternal
in class RequestContextAwareTag
javax.servlet.jsp.tagext.TagSupport#doStartTag
public void doInitBody()
public void setBodyContent(BodyContent bodyContent)
public int doAfterBody() throws JspException
JspException
protected java.lang.String readBodyContent() throws java.io.IOException
java.io.IOException
- if reading failedprotected void writeBodyContent(java.lang.String content) throws java.io.IOException
Can be overridden in subclasses, e.g. for testing purposes.
content
- the content to write
java.io.IOException
- if writing failed
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |