javax.faces.webapp
Class JspResponseWriter

java.lang.Object
  extended byjava.io.Writer
      extended byjavax.faces.context.ResponseWriter
          extended byjavax.faces.webapp.ResponseWriterBase
              extended byjavax.faces.webapp.JspResponseWriter

public final class JspResponseWriter
extends javax.faces.webapp.ResponseWriterBase

JspResponseWriter is a concrete implementation of ResponseWriter that wraps a PageContext passed to its constructor.


Field Summary
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
JspResponseWriter(PageContext pageContext)
          Create a JspResponseWriter that wraps the specified PageContext.
 
Method Summary
 void close()
          Close the underlying writer.
 void endDocument()
          Write whatever text should end a response.
 void endElement(java.lang.String name)
          Write the end of an element, after closing any open element created by a call to startElement().
 void flush()
          Flush the underlying writer's buffer, if any.
 void startDocument()
          Write whatever text should begin a response.
 void startElement(java.lang.String name)
          Write the start of an element, up to and including the element name.
 void write(char[] cbuf)
          Write an array of characters.
 void write(char[] cbuf, int off, int len)
          Write a portion of an array of characters.
 void write(int c)
          Write a single character from the low-order 16 bits of the specified integer.
 void write(java.lang.String s)
          Write a String of characters.
 void write(java.lang.String s, int off, int len)
          Write a portion of a String of characters.
 void writeAttribute(java.lang.String name, java.lang.Object value)
          Write an attribute name and corresponding value (after converting that text to a String if necessary), after escaping it properly.
 void writeComment(java.lang.Object comment)
          Write a comment containing the specified text, after converting that text to a String if necessary.
 void writeText(char text)
          Write a single character, after escaping it properly.
 void writeText(char[] text)
          Write text from a character array, after escaping it properly.
 void writeText(char[] text, int off, int len)
          Write text from a character array, after escaping it properly for this method.
 void writeText(java.lang.Object text)
          Write an object (after converting it to a String, if necessary), after escaping it properly.
 void writeURIAttribute(java.lang.String name, java.lang.Object value)
          Write a URI attribute name and corresponding value (after converting that text to a String if necessary), after encoding it properly (for example, '%' encoded for HTML).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JspResponseWriter

public JspResponseWriter(PageContext pageContext)

Create a JspResponseWriter that wraps the specified PageContext.

Throws:
java.lang.NullPointerException - if pageContext is null
Method Detail

close

public void close()
           throws java.io.IOException

Close the underlying writer.

Throws:
java.io.IOException - if an input/output error occurs

flush

public void flush()
           throws java.io.IOException

Flush the underlying writer's buffer, if any.

Throws:
java.io.IOException - if an input/output error occurs

write

public void write(char[] cbuf)
           throws java.io.IOException

Write an array of characters.

Parameters:
cbuf - An array of characters to be written
Throws:
java.io.IOException - if an input/output error occurs

write

public void write(char[] cbuf,
                  int off,
                  int len)
           throws java.io.IOException

Write a portion of an array of characters.

Parameters:
cbuf - An array of characters to be written
off - Starting offset (zero-relative)
len - Number of characters to write
Throws:
java.io.IOException - if an input/output error occurs

write

public void write(int c)
           throws java.io.IOException

Write a single character from the low-order 16 bits of the specified integer.

Parameters:
c - An int specifying the character to be written
Throws:
java.io.IOException - if an input/output error occurs

write

public void write(java.lang.String s)
           throws java.io.IOException

Write a String of characters.

Parameters:
s - A String to be written
Throws:
java.io.IOException - if an input/output error occurs

write

public void write(java.lang.String s,
                  int off,
                  int len)
           throws java.io.IOException

Write a portion of a String of characters.

Parameters:
s - A String of characters to be written
off - Starting offset (zero-relative)
len - Number of characters to write
Throws:
java.io.IOException - if an input/output error occurs

startDocument

public void startDocument()
                   throws java.io.IOException

Write whatever text should begin a response.

Specified by:
startDocument in class ResponseWriter
Throws:
java.io.IOException - if an input/output error occurs

endDocument

public 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.

Specified by:
endDocument in class ResponseWriter
Throws:
java.io.IOException - if an input/output error occurs

startElement

public void startElement(java.lang.String name)
                  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 writeAttribute() or writeURIAttribute() method 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(), or endDocument().

Specified by:
startElement in class ResponseWriter
Parameters:
name - Name of the element to be started
Throws:
java.io.IOException - if an input/output error occurs
java.lang.NullPointerException - if name is null

endElement

public 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().

Specified by:
endElement in class ResponseWriter
Parameters:
name - Name of the element to be ended
Throws:
java.io.IOException - if an input/output error occurs
java.lang.NullPointerException - if name is null

writeAttribute

public void writeAttribute(java.lang.String name,
                           java.lang.Object value)
                    throws java.io.IOException

Write an attribute name and corresponding value (after converting that text to a String if necessary), after escaping it properly. This method may only be called after a call to startElement(), and before the opened element has been closed.

Specified by:
writeAttribute in class ResponseWriter
Parameters:
name - Attribute name to be added
value - Attribute value to be added
Throws:
java.lang.IllegalStateException - if this method is called when there is no currently open element
java.io.IOException - if an input/output error occurs
java.lang.NullPointerException - if name or value is null

writeURIAttribute

public void writeURIAttribute(java.lang.String name,
                              java.lang.Object value)
                       throws java.io.IOException

Write a URI attribute name and corresponding value (after converting that text to a String if necessary), after encoding it properly (for example, '%' encoded for HTML). This method may only be called after a call to startElement(), and before the opened element has been closed.

Specified by:
writeURIAttribute in class ResponseWriter
Parameters:
name - Attribute name to be added
value - Attribute value to be added
Throws:
java.lang.IllegalStateException - if this method is called when there is no currently open element
java.io.IOException - if an input/output error occurs
java.lang.NullPointerException - if name or value is null

writeComment

public 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. If there is an open element that has been created by a call to startElement(), that element will be closed first.

Specified by:
writeComment in class ResponseWriter
Parameters:
comment - Text content of the comment
Throws:
java.io.IOException - if an input/output error occurs
java.lang.NullPointerException - if comment is null

writeText

public void writeText(java.lang.Object text)
               throws java.io.IOException

Write an object (after converting it to a String, if necessary), after escaping it properly. If there is an open element that has been created by a call to startElement(), that element will be closed first.

Specified by:
writeText in class ResponseWriter
Parameters:
text - Text to be written
Throws:
java.io.IOException - if an input/output error occurs
java.lang.NullPointerException - if text is null

writeText

public void writeText(char text)
               throws java.io.IOException

Write a single character, after escaping it properly. If there is an open element that has been created by a call to startElement(), that element will be closed first.

Specified by:
writeText in class ResponseWriter
Parameters:
text - Text to be written
Throws:
java.io.IOException - if an input/output error occurs

writeText

public void writeText(char[] text)
               throws java.io.IOException

Write text from a character array, after escaping it properly. This is equivalent to calling writeText(c, 0, c.length). If there is an open element that has been created by a call to startElement(), that element will be closed first.

Specified by:
writeText in class ResponseWriter
Parameters:
text - Text to be written
Throws:
java.io.IOException - if an input/output error occurs
java.lang.NullPointerException - if text is null

writeText

public void writeText(char[] text,
                      int off,
                      int len)
               throws java.io.IOException

Write text from a character array, after escaping it properly for this method. If there is an open element that has been created by a call to startElement(), that element will be closed first.

Specified by:
writeText in class ResponseWriter
Parameters:
text - Text to be written
off - Starting offset (zero-relative)
len - Number of characters to be written
Throws:
java.lang.IndexOutOfBoundsException - if the calculated starting or ending position is outside the bounds of the character array
java.io.IOException - if an input/output error occurs
java.lang.NullPointerException - if text is null