Class Hierarchy All Classes All Fields and Methods
Class com.sun.faces.renderkit.html_basic.HtmlResponseWriter
java.lang.Object java.io.Writer javax.faces.context.ResponseWriter com.sun.faces.renderkit.html_basic.HtmlResponseWriterpublic class HtmlResponseWriter
extends ResponseWriter
HtmlResponseWriter is an Html specific implementation of the ResponseWriter abstract class. Kudos to Adam Winer (Oracle) for much of this code.
Constructor Index Constructor Description HtmlResponseWriter(Writer, String, String) Constructor sets the ResponseWriter and encoding.
Method Index Method Description ResponseWriter cloneWithWriter(Writer) Create a new instance of this ResponseWriter using a different Writer. void close() Methods From java.io.Writer void endDocument() Output the text for the end of a document. void endElement(String) Write the end of an element. void flush() Flush any buffered output to the contained writer. String getCharacterEncoding() String getContentType() void startDocument() Write the text that should begin a response. void startElement(String, UIComponent) Write the start of an element, up to and including the element name. void write(char) void write(char[], int, int) void write(int) void write(String) void write(String, int, int) void writeAttribute(String, Object, String) Write a properly escaped attribute name and the corresponding value. void writeComment(Object) Write a comment string containing the specified text. void writeText(char) Write a properly escaped single character, If there is an open element that has been created by a call to startElement(), that element will be closed first. void writeText(char[]) Write properly escaped text from a character array. void writeText(char[], int, int) Write properly escaped text from a character array. void writeText(Object, String) Write a properly escaped object. void writeURIAttribute(String, Object, String) Write a properly encoded URI attribute name and the corresponding value.
Constructors
HtmlResponseWriter
public HtmlResponseWriter(Writer writer, String contentType, String encoding) throws FacesExceptionConstructor sets the ResponseWriter and encoding.
- Parameters
- writer - the ResponseWriter
- contentType - the content type.
- encoding - the character encoding.
- Throws
- if the encoding is not recognized.
Methods
cloneWithWriter
public ResponseWriter cloneWithWriter(Writer writer)
Create a new instance of this ResponseWriter using a different Writer.
- Parameters
- writer - The Writer that will be used to create another ResponseWriter.
- Overrides
- cloneWithWriter in class ResponseWriter
close
public void close() throws IOExceptionMethods From java.io.Writer
endDocument
public void endDocument() throws IOExceptionOutput the text for the end of a document.
endElement
public void endElement(String name) throws IOException
Write the end of an element. This method will first close any open element created by a call to startElement().
- Parameters
- name - Name of the element to be ended
- Throws
- IOException if an input/output error occurs
- Throws
- NullPointerException if name is null
- Overrides
- endElement in class ResponseWriter
flush
public void flush() throws IOExceptionFlush any buffered output to the contained writer.
- Throws
- IOException if an input/output error occurs.
- Overrides
- flush in class ResponseWriter
getCharacterEncoding
public String getCharacterEncoding()
- Returns
- the character encoding, such as "ISO-8859-1" for this ResponseWriter. Refer to: theIANA for a list of character encodings.
- Overrides
- getCharacterEncoding in class ResponseWriter
getContentType
public String getContentType()
- Returns
- the content type such as "text/html" for this ResponseWriter.
- Overrides
- getContentType in class ResponseWriter
startDocument
public void startDocument() throws IOException
Write the text that should begin a response.
- Throws
- IOException if an input/output error occurs
- Overrides
- startDocument in class ResponseWriter
startElement
public void startElement(String name, UIComponent componentForElement) throws IOException
Write the start of an element, up to and including the element name. Clients call writeAttribute() or writeURIAttribute() methods to add attributes after calling this method.
- Parameters
- name - Name of the starting element
- componentForElement - The UIComponent instance that applies to this element. This argument may be null.
- Throws
- IOException if an input/output error occurs
- Throws
- NullPointerException if name is null
- Overrides
- startElement in class ResponseWriter
write
public void write(char cbuf) throws IOException
write
public void write(char[] cbuf, int off, int len) throws IOException
write
public void write(int c) throws IOException
write
public void write(String str) throws IOException
write
public void write(String str, int off, int len) throws IOException
writeAttribute
public void writeAttribute(String name, Object value, String componentPropertyName) throws IOException
Write a properly escaped attribute name and the corresponding value. The value text will be converted to a String if necessary. This method may only be called after a call to startElement(), and before the opened element has been closed.
- Parameters
- name - Attribute name to be added
- value - Attribute value to be added
- componentPropertyName - The name of the component property to which this attribute argument applies. This argument may be null.
- Throws
- IllegalStateException if this method is called when there is no currently open element
- Throws
- IOException if an input/output error occurs
- Throws
- NullPointerException if name or value is null
- Overrides
- writeAttribute in class ResponseWriter
writeComment
public void writeComment(Object comment) throws IOException
Write a comment string containing the specified text. The text will be converted 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.
- Parameters
- comment - Text content of the comment
- Throws
- IOException if an input/output error occurs
- Throws
- NullPointerException if comment is null
- Overrides
- writeComment in class ResponseWriter
writeText
public void writeText(char text) throws IOException
Write a properly escaped single character, If there is an open element that has been created by a call to startElement(), that element will be closed first.
All angle bracket occurrences in the argument must be escaped using the > < syntax.
- Parameters
- text - Text to be written
- Throws
- IOException if an input/output error occurs
writeText
public void writeText(char[] text) throws IOException
Write properly escaped text from a character array. The output from this command is identical to the invocation: 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.
All angle bracket occurrences in the argument must be escaped using the > < syntax.
- Parameters
- text - Text to be written
- Throws
- IOException if an input/output error occurs
- Throws
- NullPointerException if text is null
writeText
public void writeText(char[] text, int off, int len) throws IOException
Write properly escaped text from a character array. If there is an open element that has been created by a call to startElement(), that element will be closed first.
All angle bracket occurrences in the argument must be escaped using the > < syntax.
- Parameters
- text - Text to be written
- off - Starting offset (zero-relative)
- len - Number of characters to be written
- Throws
- IndexOutOfBoundsException if the calculated starting or ending position is outside the bounds of the character array
- Throws
- IOException if an input/output error occurs
- Throws
- NullPointerException if text is null
- Overrides
- writeText in class ResponseWriter
writeText
public void writeText(Object text, String componentPropertyName) throws IOException
Write a properly escaped object. The object will be converted 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.
- Parameters
- text - Text to be written
- componentPropertyName - The name of the component property to which this text argument applies. This argument may be null.
- Throws
- IOException if an input/output error occurs
- Throws
- NullPointerException if text is null
- Overrides
- writeText in class ResponseWriter
writeURIAttribute
public void writeURIAttribute(String name, Object value, String componentPropertyName) throws IOException
Write a properly encoded URI attribute name and the corresponding value. The value text will be converted to a String if necessary). This method may only be called after a call to startElement(), and before the opened element has been closed.
- Parameters
- name - Attribute name to be added
- value - Attribute value to be added
- componentPropertyName - The name of the component property to which this attribute argument applies. This argument may be null.
- Throws
- IllegalStateException if this method is called when there is no currently open element
- Throws
- IOException if an input/output error occurs
- Throws
- NullPointerException if name or value is null
- Overrides
- writeURIAttribute in class ResponseWriter
Class Hierarchy All Classes All Fields and Methods