Devsphere.com


com.devsphere.xml.taglib.output.tag
Class OutputSupport

java.lang.Object
  |
  +--javax.servlet.jsp.tagext.TagSupport
        |
        +--javax.servlet.jsp.tagext.BodyTagSupport
              |
              +--com.devsphere.xml.taglib.support.tag.CommonSupport
                    |
                    +--com.devsphere.xml.taglib.output.tag.OutputSupport
All Implemented Interfaces:
javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, java.io.Serializable, javax.servlet.jsp.tagext.Tag, javax.servlet.jsp.tagext.TryCatchFinally
Direct Known Subclasses:
Attribute, Attributes, Comment, Data, Element, Fragment, PI

public abstract class OutputSupport
extends CommonSupport

This class provides support for XML output tag handlers.

See Also:
Serialized Form

Field Summary
protected  OutputSupport ancestor
          The tag handler of the nearest ancestor tag.
protected  java.io.Writer previousOut
          The previous JSP out used by the serializer object.
protected  Serializer serializer
          An object used to produce the XML content.
 
Fields inherited from class com.devsphere.xml.taglib.support.tag.CommonSupport
cachedDebug, cachedLogger, DEBUG_ATTR, DEFAULT_DEBUG, DEFAULT_RESTORE_VALUE, DEFAULT_SCOPE, LOGGER_ATTR, originalValues
 
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
OutputSupport()
           
 
Method Summary
 int doEndTag()
          Calls endOutput() and returns EVAL_PAGE.
 int doStartTag()
          Calls initOutput() and then startOutput().
protected  void emptyComment()
          Produces an empty comment.
protected abstract  void endOutput()
          Subclasses must implement this method to end the XML content that the handled tag is supposed to produce.
protected  void init()
          Initializes the fields of this tag handler.
protected  void initOutput()
          Initializes this tag handler for output, finding the nearest ancestor tag so that the current tag can be validated and handled within its context.
protected  boolean shouldBufferContent()
          Returns false.
protected  boolean shouldIgnoreContent()
          Returns false.
protected abstract  void startOutput()
          Subclasses must implement this method to start the XML content that the handled tag is supposed to produce.
 
Methods inherited from class com.devsphere.xml.taglib.support.tag.CommonSupport
checkVarName, checkVarScope, doCatch, doFinally, eval, evalBoolean, evalDouble, evalInt, evalString, export, export, getAllowedAncestors, getDebug, getLogger, getTagName, log, log, log, restore, validate
 
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
doAfterBody, doInitBody, 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
 

Field Detail

ancestor

protected OutputSupport ancestor
The tag handler of the nearest ancestor tag.


serializer

protected Serializer serializer
An object used to produce the XML content.


previousOut

protected java.io.Writer previousOut
The previous JSP out used by the serializer object.

Constructor Detail

OutputSupport

public OutputSupport()
Method Detail

init

protected void init()
Initializes the fields of this tag handler.

Overrides:
init in class CommonSupport

shouldIgnoreContent

protected boolean shouldIgnoreContent()
Returns false. Subclasses may override this method to return true if the body content of the handled tag should be ignored during the execution of the JSP page.

Returns:
a flag indicating whether the body content of this tag should be ignored or evaluated

shouldBufferContent

protected boolean shouldBufferContent()
Returns false. Subclasses may override this method to return true if the body content of the handled tag should be buffered during the execution of the JSP page.

Returns:
a flag indicating if the body content of this tag should be buffered

initOutput

protected void initOutput()
                   throws javax.servlet.jsp.JspException
Initializes this tag handler for output, finding the nearest ancestor tag so that the current tag can be validated and handled within its context.

Throws:
javax.servlet.jsp.JspException - to signal a tag validation error

startOutput

protected abstract void startOutput()
                             throws javax.servlet.jsp.JspException,
                                    org.xml.sax.SAXException
Subclasses must implement this method to start the XML content that the handled tag is supposed to produce.

Throws:
javax.servlet.jsp.JspException - to signal an error
org.xml.sax.SAXException - to signal an error

endOutput

protected abstract void endOutput()
                           throws javax.servlet.jsp.JspException,
                                  org.xml.sax.SAXException
Subclasses must implement this method to end the XML content that the handled tag is supposed to produce.

Throws:
javax.servlet.jsp.JspException - to signal an error
org.xml.sax.SAXException - to signal an error

emptyComment

protected void emptyComment()
                     throws javax.servlet.jsp.JspException,
                            org.xml.sax.SAXException
Produces an empty comment. This forces the serializer to flush its buffer. Those empty comments are eliminated by a filter and do not show up in the final output.

Throws:
javax.servlet.jsp.JspException - to signal an error
org.xml.sax.SAXException - to signal an error

doStartTag

public int doStartTag()
               throws javax.servlet.jsp.JspException
Calls initOutput() and then startOutput(). This method returns

Specified by:
doStartTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doStartTag in class javax.servlet.jsp.tagext.BodyTagSupport
Returns:
a code that tells the Servlet container what to do with the body content of the handled tag.
Throws:
javax.servlet.jsp.JspException - to signal an error

doEndTag

public int doEndTag()
             throws javax.servlet.jsp.JspException
Calls endOutput() and returns EVAL_PAGE.

Specified by:
doEndTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doEndTag in class javax.servlet.jsp.tagext.BodyTagSupport
Returns:
EVAL_PAGE.
javax.servlet.jsp.JspException

 Devsphere.com