FileDocCategorySizeDatePackage
BodyContent.javaAPI DocGlassfish v2 API5204Fri May 04 22:34:16 BST 2007javax.servlet.jsp.tagext

BodyContent

public abstract class BodyContent extends JspWriter
An encapsulation of the evaluation of the body of an action so it is available to a tag handler. BodyContent is a subclass of JspWriter.

Note that the content of BodyContent is the result of evaluation, so it will not contain actions and the like, but the result of their invocation.

BodyContent has methods to convert its contents into a String, to read its contents, and to clear the contents.

The buffer size of a BodyContent object is unbounded. A BodyContent object cannot be in autoFlush mode. It is not possible to invoke flush on a BodyContent object, as there is no backing stream.

Instances of BodyContent are created by invoking the pushBody and popBody methods of the PageContext class. A BodyContent is enclosed within another JspWriter (maybe another BodyContent object) following the structure of their associated actions.

A BodyContent is made available to a BodyTag through a setBodyContent() call. The tag handler can use the object until after the call to doEndTag().

Fields Summary
private JspWriter
enclosingWriter
Constructors Summary
protected BodyContent(JspWriter e)
Protected constructor. Unbounded buffer, no autoflushing.

param
e the enclosing JspWriter

	super(UNBOUNDED_BUFFER , false);
	this.enclosingWriter = e;
    
Methods Summary
public voidclearBody()
Clear the body without throwing any exceptions.

	try {
	    this.clear();
	} catch (IOException ex) {
	    // TODO -- clean this one up.
	    throw new Error("internal error!;");
	}
    
public voidflush()
Redefined flush() so it is not legal.

It is not valid to flush a BodyContent because there is no backing stream behind it.

throws
IOException always thrown

	throw new IOException("Illegal to flush within a custom tag");
    
public JspWritergetEnclosingWriter()
Get the enclosing JspWriter.

return
the enclosing JspWriter passed at construction time

	return enclosingWriter;
    
public abstract java.io.ReadergetReader()
Return the value of this BodyContent as a Reader.

return
the value of this BodyContent as a Reader

public abstract java.lang.StringgetString()
Return the value of the BodyContent as a String.

return
the value of the BodyContent as a String

public abstract voidwriteOut(java.io.Writer out)
Write the contents of this BodyContent into a Writer. Subclasses may optimize common invocation patterns.

param
out The writer into which to place the contents of this body evaluation
throws
IOException if an I/O error occurred while writing the contents of this BodyContent to the given Writer