public abstract class ResponseWriter
extends java.io.Writer
ResponseWriter
 is an abstract class describing an adapter to an underlying output
 mechanism for character-based output.  In addition to the low-level
 write() methods inherited from
 java.io.Writer, this class provides utility methods that
 are useful in producing elements and attributes for markup languages
 like HTML and XML.
| Constructor and Description | 
|---|
| ResponseWriter() | 
| Modifier and Type | Method and Description | 
|---|---|
| abstract ResponseWriter | cloneWithWriter(java.io.Writer writer)Create and return a new instance of this  ResponseWriter,
 using the specifiedWriteras the output destination. | 
| void | endCDATA()Close an XML  | 
| abstract void | endDocument()Write whatever text should end a response. | 
| abstract void | endElement(java.lang.String name)Write the end of an element, 
 after closing any open element
 created by a call to  startElement(). | 
| abstract void | flush()Flush any ouput buffered by the output method to the
 underlying Writer or OutputStream. | 
| abstract java.lang.String | getCharacterEncoding()Return the character encoding (such as "ISO-8859-1") for this
  ResponseWriter. | 
| abstract java.lang.String | getContentType()Return the content type (such as "text/html") for this  ResponseWriter. | 
| void | startCDATA()Open an XML  | 
| abstract void | startDocument()Write whatever text should begin a response. | 
| abstract void | startElement(java.lang.String name,
            UIComponent component)Write the start of an element, 
       up to and including the
 element name. | 
| abstract void | writeAttribute(java.lang.String name,
              java.lang.Object value,
              java.lang.String property)Write an attribute name and corresponding value, after converting
 that text to a String (if necessary), and after performing any escaping
 appropriate for the markup language being rendered. | 
| abstract void | writeComment(java.lang.Object comment)Write a comment containing the specified text, after converting
 that text to a String (if necessary), and after performing any escaping
 appropriate for the markup language being rendered. | 
| void | writeDoctype(java.lang.String doctype)Write a string containing the markup specific doctype. | 
| void | writePreamble(java.lang.String preamble)Write a string containing the markup specific preamble. | 
| abstract void | writeText(char[] text,
         int off,
         int len)Write text from a character array, after any performing any
 escaping appropriate for the markup language being rendered. | 
| abstract void | writeText(java.lang.Object text,
         java.lang.String property)Write an object, after converting it to a String (if necessary),
 and after performing any escaping appropriate for the markup language
 being rendered. | 
| void | writeText(java.lang.Object text,
         UIComponent component,
         java.lang.String property)Write an object, after converting it to a String (if
 necessary), and after performing any escaping appropriate for the
 markup language being rendered. | 
| abstract void | writeURIAttribute(java.lang.String name,
                 java.lang.Object value,
                 java.lang.String property)Write a URI
 attribute name and corresponding value, after converting that
 text to a String (if necessary), and after performing any
 encoding or escaping
 appropriate to the markup language being rendered. | 
public abstract java.lang.String getContentType()
Return the content type (such as "text/html") for this ResponseWriter.  Note: this must not include the "charset="
 suffix.
public abstract java.lang.String getCharacterEncoding()
Return the character encoding (such as "ISO-8859-1") for this
 ResponseWriter.  Please see the
 IANA for a list of character encodings.
public abstract void flush()
                    throws java.io.IOException
Flush any ouput buffered by the output method to the
 underlying Writer or OutputStream.  This method
 will not flush the underlying Writer or OutputStream;  it
 simply clears any values buffered by this ResponseWriter.
flush in interface java.io.Flushableflush in class java.io.Writerjava.io.IOExceptionpublic abstract void startDocument()
                            throws java.io.IOException
Write whatever text should begin a response.
java.io.IOException - if an input/output error occurspublic abstract void endDocument()
                          throws java.io.IOException
Write whatever text should end a response.  If there is an open
 element that has been created by a call to startElement(),
 that element will be closed first.
java.io.IOException - if an input/output error occurspublic abstract void startElement(java.lang.String name,
                                  UIComponent component)
                           throws java.io.IOException
Write the start of an element, 
       up to and including the
 element name.  Once this method has been called, clients can
 call the writeAttribute() or
 writeURIAttribute() methods to add attributes and
 corresponding values.  The starting element will be closed
 (that is, the trailing '>' character added)
 on any subsequent call to startElement(),
 writeComment(),
 writeText(), endElement(),
 endDocument(), close(),
 flush(), or write().
If the argument component's pass through attributes 
 includes an attribute of the name given by the value of the symbolic
 constant Renderer.PASSTHROUGH_RENDERER_LOCALNAME_KEY,
 use that as the element name, instead of the value passed as the first 
 parameter to this method.  Care must be taken so that this value
 is not also rendered when any other pass through attributes on this component
 are rendered.
name - Name of the element to be startedcomponent - The UIComponent (if any) to which this
                  element corresponds.   This component is
                  inspected for its pass through attributes as
                  described in the standard HTML_BASIC RenderKit specification.java.io.IOException - if an input/output error occursjava.lang.NullPointerException - if name
                              is nullpublic abstract void endElement(java.lang.String name)
                         throws java.io.IOException
Write the end of an element, 
 after closing any open element
 created by a call to startElement().  Elements must be
 closed in the inverse order from which they were opened; it is an
 error to do otherwise.
If the argument component's pass through attributes 
 includes an attribute of the name given by the value of the symbolic
 constant Renderer.PASSTHROUGH_RENDERER_LOCALNAME_KEY,
 use that as the element name, instead of the value passed as the first 
 parameter to this method.
name - Name of the element to be endedjava.io.IOException - if an input/output error occursjava.lang.NullPointerException - if name
                              is nullpublic abstract void writeAttribute(java.lang.String name,
                                    java.lang.Object value,
                                    java.lang.String property)
                             throws java.io.IOException
Write an attribute name and corresponding value, after converting
 that text to a String (if necessary), and after performing any escaping
 appropriate for the markup language being rendered.
 This method may only be called after a call to
 startElement(), and before the opened element has been
 closed.
name - Attribute name to be addedvalue - Attribute value to be addedproperty - Name of the property or attribute (if any) of the
                 UIComponent associated with the containing element,
                 to which this generated attribute correspondsjava.lang.IllegalStateException - if this method is called when there
                               is no currently open elementjava.io.IOException - if an input/output error occursjava.lang.NullPointerException - if name is
                               nullpublic abstract void writeURIAttribute(java.lang.String name,
                                       java.lang.Object value,
                                       java.lang.String property)
                                throws java.io.IOException
Write a URI
 attribute name and corresponding value, after converting that
 text to a String (if necessary), and after performing any
 encoding or escaping
 appropriate to the markup language being rendered.  When rendering in a WWW environment,
 the escaping conventions established in the W3C URI spec document
 <http://www.w3.org/Addressing/URL/uri-spec.html>
 must be followed.  In particular, spaces ' ' must be encoded as
 %20 and not the plus character '+'. This method may only
 be called after a call to startElement(), and before
 the opened element has been closed.
name - Attribute name to be addedvalue - Attribute value to be addedproperty - Name of the property or attribute (if any) of the
                 UIComponent associated with the containing element,
                 to which this generated attribute correspondsjava.lang.IllegalStateException - if this method is called when there
                               is no currently open elementjava.io.IOException - if an input/output error occursjava.lang.NullPointerException - if name is
                               nullpublic void startCDATA()
                throws java.io.IOException
Open an XML CDATA
 block.  Note that XML does not allow nested CDATA
 blocks, though this method does not enforce that constraint.  The
 default implementation of this method takes no action when
 invoked.
java.io.IOException - if input/output error occurespublic void endCDATA()
              throws java.io.IOException
Close an XML CDATA
 block.  The default implementation of this method takes no action
 when invoked.
java.io.IOException - if input/output error occurespublic abstract void writeComment(java.lang.Object comment)
                           throws java.io.IOException
Write a comment containing the specified text, after converting
 that text to a String (if necessary), and after performing any escaping
 appropriate for the markup language being rendered.  If there is
 an open element that has been created by a call to
 startElement(), that element will be closed first.
comment - Text content of the commentjava.io.IOException - if an input/output error occursjava.lang.NullPointerException - if comment
                              is nullpublic void writePreamble(java.lang.String preamble)
                   throws java.io.IOException
Write a string containing the markup specific
 preamble.
 No escaping is performed. The default 
 implementation simply calls through to Writer.write(java.lang.String) .
The implementation makes no checks if this is the correct place in the response to have a preamble, nor does it prevent the preamble from being written more than once.
preamble - Text content of the preamblejava.io.IOException - if an input/output error occurspublic void writeDoctype(java.lang.String doctype)
                  throws java.io.IOException
Write a string containing the markup specific
 doctype.
 No escaping is performed. The default 
 implementation simply calls through to Writer.write(java.lang.String) .
The implementation makes no checks if this is the correct place in the response to have a doctype, nor does it prevent the doctype from being written more than once.
doctype - Text content of the doctypejava.io.IOException - if an input/output error occurspublic abstract void writeText(java.lang.Object text,
                               java.lang.String property)
                        throws java.io.IOException
Write an object, after converting it to a String (if necessary),
 and after performing any escaping appropriate for the markup language
 being rendered.  If there is an open element that has been created
 by a call to startElement(), that element will be closed
 first.
text - Text to be writtenproperty - Name of the property or attribute (if any) of the
                 UIComponent associated with the containing element,
                 to which this generated text correspondsjava.io.IOException - if an input/output error occursjava.lang.NullPointerException - if text
                              is nullpublic void writeText(java.lang.Object text,
                      UIComponent component,
                      java.lang.String property)
               throws java.io.IOException
Write an object, after converting it to a String (if
 necessary), and after performing any escaping appropriate for the
 markup language being rendered.  This method is equivalent to
 writeText(java.lang.Object,java.lang.String) but adds a
 component property to allow custom
 ResponseWriter implementations to associate a
 component with an arbitrary portion of text.
The default implementation simply ignores the
 component argument and calls through to writeText(java.lang.Object,java.lang.String)
text - Text to be writtencomponent - The UIComponent (if any) to which
                  this element correspondsproperty - Name of the property or attribute (if any) of the
                  UIComponent associated with the containing element,
                  to which this generated text correspondsjava.io.IOException - if an input/output error occursjava.lang.NullPointerException - if text
                              is nullpublic abstract void writeText(char[] text,
                               int off,
                               int len)
                        throws java.io.IOException
Write text from a character array, after any performing any
 escaping appropriate for the markup language being rendered.
 If there is an open element that has been created by a call to
 startElement(), that element will be closed first.
text - Text to be writtenoff - Starting offset (zero-relative)len - Number of characters to be writtenjava.lang.IndexOutOfBoundsException - if the calculated starting or
                                   ending position is outside the bounds of the character arrayjava.io.IOException - if an input/output error occursjava.lang.NullPointerException - if text
                                   is nullpublic abstract ResponseWriter cloneWithWriter(java.io.Writer writer)
Create and return a new instance of this ResponseWriter,
 using the specified Writer as the output destination.
writer - The Writer that is the output destinationResponseWriter