Class EncodingNullBodyTag
- All Implemented Interfaces:
Serializable
,BodyTag
,IterationTag
,JspTag
,Tag
,TryCatchFinally
- Direct Known Subclasses:
OutTag
- Author:
- AO Industries, Inc.
- See Also:
-
Field Summary
Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport
bodyContent
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext
Fields inherited from interface javax.servlet.jsp.tagext.BodyTag
EVAL_BODY_BUFFERED, EVAL_BODY_TAG
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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
Deprecated.protected int
doAfterBody
(Writer out) While the outJspWriter
is still replaced to output the proper content type, this version ofdoAfterBody()
is called.void
int
doEndTag()
Deprecated.You should probably be implementing indoEndTag(java.io.Writer)
protected int
While the outJspWriter
is still replaced to output the proper content type, this version ofdoEndTag()
is called.void
void
The only way to replace the "out" variable in the generated JSP is to useBodyTag.EVAL_BODY_BUFFERED
.int
Deprecated.You should probably be implementing indoStartTag(java.io.Writer)
protected int
doStartTag
(Writer out) Once the outJspWriter
has been replaced to output the proper content type, this version ofdoStartTag()
is called.abstract MediaType
Gets the output type of this tag.protected void
setMediaEncoderOptions
(MediaEncoder mediaEncoder) Sets the media encoder options.protected void
writeEncoderPrefix
(MediaEncoder mediaEncoder, Writer out) protected void
writeEncoderSuffix
(MediaEncoder mediaEncoder, Writer out, boolean trim) protected void
writePrefix
(MediaType containerType, Writer out) Writes any prefix in the container's media type.protected void
writeSuffix
(MediaType containerType, Writer out) Writes any suffix in the container's media type.Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
getBodyContent, getPreviousOut, release, setBodyContent
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface javax.servlet.jsp.tagext.Tag
getParent, setPageContext, setParent
-
Constructor Details
-
EncodingNullBodyTag
protected EncodingNullBodyTag()
-
-
Method Details
-
getOutputType
Gets the output type of this tag. This is used to determine the correct encoder. If the tag never has any output this should returnnull
. Whennull
is returned, any output will result in an error. -
doStartTag
Deprecated.You should probably be implementing indoStartTag(java.io.Writer)
- Specified by:
doStartTag
in interfaceTag
- Overrides:
doStartTag
in classBodyTagSupport
- Throws:
JspException
- See Also:
-
doStartTag
Once the outJspWriter
has been replaced to output the proper content type, this version ofdoStartTag()
is called.- Parameters:
out
- When the output type isnull
, will throw an exception if anything written, otherwise validates all characters against the output type. Already optimized viaCoercion.optimize(java.io.Writer, com.aoapps.lang.io.Encoder)
.- Returns:
- Must return either
BodyTag.EVAL_BODY_BUFFERED
(the default) orTag.SKIP_BODY
- Throws:
JspException
IOException
-
doInitBody
The only way to replace the "out" variable in the generated JSP is to use
BodyTag.EVAL_BODY_BUFFERED
. Without this, any writer given toJspContext.pushBody(java.io.Writer)
is not used. We want to useNullWriter
to discard data on-the-fly.To workaround this issue, this very hackily replaces the writer field directly on the
BodyContentImpl
. When unable to replace the field, falls back to using the standard buffering (much less desirable).This is similar to the direct field access performed by
BodyContentImplCoercionOptimizerInitializer
.- Specified by:
doInitBody
in interfaceBodyTag
- Overrides:
doInitBody
in classBodyTagSupport
- Throws:
JspException
-
doAfterBody
Deprecated.You should probably be implementing indoAfterBody(java.io.Writer)
- Specified by:
doAfterBody
in interfaceIterationTag
- Overrides:
doAfterBody
in classBodyTagSupport
- Throws:
JspException
- See Also:
-
doAfterBody
While the outJspWriter
is still replaced to output the proper content type, this version ofdoAfterBody()
is called.- Parameters:
out
- When the output type isnull
, will throw an exception if anything written, otherwise validates all characters against the output type. Already optimized viaCoercion.optimize(java.io.Writer, com.aoapps.lang.io.Encoder)
.- Returns:
- Must return either
Tag.SKIP_BODY
(the default) orIterationTag.EVAL_BODY_AGAIN
- Throws:
JspException
IOException
-
doEndTag
Deprecated.You should probably be implementing indoEndTag(java.io.Writer)
- Specified by:
doEndTag
in interfaceTag
- Overrides:
doEndTag
in classBodyTagSupport
- Throws:
JspException
- See Also:
-
doEndTag
While the outJspWriter
is still replaced to output the proper content type, this version ofdoEndTag()
is called.- Parameters:
out
- When the output type isnull
, will throw an exception if anything written, otherwise validates all characters against the output type. Already optimized viaCoercion.optimize(java.io.Writer, com.aoapps.lang.io.Encoder)
.- Returns:
- Must return either
Tag.EVAL_PAGE
(the default) orTag.SKIP_PAGE
- Throws:
JspException
IOException
-
doCatch
- Specified by:
doCatch
in interfaceTryCatchFinally
- Throws:
Throwable
-
doFinally
public void doFinally()- Specified by:
doFinally
in interfaceTryCatchFinally
-
writePrefix
Writes any prefix in the container's media type. The output must be valid for the provided type. This will not be called when the initial output type is
null
.This default implementation prints nothing.
- Parameters:
out
- Validates all characters against the container media type. Already optimized viaCoercion.optimize(java.io.Writer, com.aoapps.lang.io.Encoder)
.- Throws:
JspException
IOException
- See Also:
-
setMediaEncoderOptions
Sets the media encoder options. This is how subclass tag attributes can effect the encoding. -
writeEncoderPrefix
protected void writeEncoderPrefix(MediaEncoder mediaEncoder, Writer out) throws JspException, IOException - Parameters:
out
- Validates all characters against the container media type. Already optimized viaCoercion.optimize(java.io.Writer, com.aoapps.lang.io.Encoder)
.- Throws:
JspException
IOException
-
writeEncoderSuffix
protected void writeEncoderSuffix(MediaEncoder mediaEncoder, Writer out, boolean trim) throws JspException, IOException - Parameters:
out
- Validates all characters against the container media type. Already optimized viaCoercion.optimize(java.io.Writer, com.aoapps.lang.io.Encoder)
.- Throws:
JspException
IOException
-
writeSuffix
Writes any suffix in the container's media type. The output must be valid for the provided type. This will not be called when the initial output type is
null
.This default implementation prints nothing.
- Parameters:
out
- Validates all characters against the container media type. Already optimized viaCoercion.optimize(java.io.Writer, com.aoapps.lang.io.Encoder)
.- Throws:
JspException
IOException
- See Also:
-
doAfterBody(java.io.Writer)