javax.faces.context

## Class ResponseWriterWrapper

- java.lang.Object
- - java.io.Writer
  - - javax.faces.context.ResponseWriter
    - - javax.faces.context.ResponseWriterWrapper

- All Implemented Interfaces:
    Closeable, Flushable, Appendable, AutoCloseable, FacesWrapper<ResponseWriter>
  Direct Known Subclasses:
    PartialResponseWriter

      public abstract class ResponseWriterWrapper
      extends ResponseWriter
      implements FacesWrapper<ResponseWriter>

  Provides a simple implementation of `ResponseWriter` that can be subclassed by developers wishing to provide specialized behavior to an existing `ResponseWriter` instance. The default implementation of all methods is to call through to the wrapped `ResponseWriter`.

  Usage: extend this class and override `getWrapped()` to return the instance we are wrapping.

  Since:
    1.2

- - ### Field Summary

    - ### Fields inherited from class java.io.Writer

      `lock`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ResponseWriterWrapper()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `ResponseWriter` | `cloneWithWriter(Writer writer)` The default behavior of this method is to call `ResponseWriter.cloneWithWriter(java.io.Writer)` on the wrapped `ResponseWriter` object.
    `void` | `close()` The default behavior of this method is to call `Writer.close()` on the wrapped `ResponseWriter` object.
    `void` | `endCDATA()` The default behavior of this method is to call `ResponseWriter.endCDATA()` on the wrapped `ResponseWriter` object.
    `void` | `endDocument()` The default behavior of this method is to call `ResponseWriter.endDocument()` on the wrapped `ResponseWriter` object.
    `void` | `endElement(String name)` The default behavior of this method is to call `ResponseWriter.endElement(String)` on the wrapped `ResponseWriter` object.
    `void` | `flush()` The default behavior of this method is to call `ResponseWriter.flush()` on the wrapped `ResponseWriter` object.
    `String` | `getCharacterEncoding()` The default behavior of this method is to call `ResponseWriter.getCharacterEncoding()` on the wrapped `ResponseWriter` object.
    `String` | `getContentType()` The default behavior of this method is to call `ResponseWriter.getContentType()` on the wrapped `ResponseWriter` object.
    `abstract ResponseWriter` | `getWrapped()` Return the instance that we are wrapping.
    `void` | `startCDATA()` The default behavior of this method is to call `ResponseWriter.startCDATA()` on the wrapped `ResponseWriter` object.
    `void` | `startDocument()` The default behavior of this method is to call `ResponseWriter.startDocument()` on the wrapped `ResponseWriter` object.
    `void` | `startElement(String name, UIComponent component)` The default behavior of this method is to call `ResponseWriter.startElement(String, javax.faces.component.UIComponent)` on the wrapped `ResponseWriter` object.
    `void` | `write(char[] cbuf, int off, int len)` The default behavior of this method is to call `Writer.write(char[], int, int)` on the wrapped `ResponseWriter` object.
    `void` | `writeAttribute(String name, Object value, String property)` The default behavior of this method is to call `ResponseWriter.writeAttribute(String, Object, String)` on the wrapped `ResponseWriter` object.
    `void` | `writeComment(Object comment)` The default behavior of this method is to call `ResponseWriter.writeComment(Object)` on the wrapped `ResponseWriter` object.
    `void` | `writeDoctype(String doctype)` The default behavior of this method is to call `ResponseWriter.writeDoctype(java.lang.String)` on the wrapped `ResponseWriter` object.
    `void` | `writePreamble(String preamble)` The default behavior of this method is to call `ResponseWriter.writePreamble(java.lang.String)` on the wrapped `ResponseWriter` object.
    `void` | `writeText(char[] text, int off, int len)` The default behavior of this method is to call `ResponseWriter.writeText(char[], int, int)` on the wrapped `ResponseWriter` object.
    `void` | `writeText(Object text, String property)` The default behavior of this method is to call `ResponseWriter.writeText(Object, String)` on the wrapped `ResponseWriter` object.
    `void` | `writeText(Object text, UIComponent component, String property)` The default behavior of this method is to call `ResponseWriter.writeText(Object, UIComponent, String)` on the wrapped `ResponseWriter` object.
    `void` | `writeURIAttribute(String name, Object value, String property)` The default behavior of this method is to call `ResponseWriter.writeURIAttribute(String, Object, String)` on the wrapped `ResponseWriter` object.

    - ### Methods inherited from class java.io.Writer

      `append, append, append, write, write, write, write`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ResponseWriterWrapper

          public ResponseWriterWrapper()

  - ### Method Detail

    - #### getWrapped

          public abstract ResponseWriter getWrapped()

      Return the instance that we are wrapping. As of version 2, this method is public.

      Specified by:
        `getWrapped` in interface `FacesWrapper<ResponseWriter>`

    - #### getContentType

          public String getContentType()

      The default behavior of this method is to call `ResponseWriter.getContentType()` on the wrapped `ResponseWriter` object.

      Specified by:
        `getContentType` in class `ResponseWriter`
      Since:
        1.2
      See Also:
        `ResponseWriter.getContentType()`

    - #### getCharacterEncoding

          public String getCharacterEncoding()

      The default behavior of this method is to call `ResponseWriter.getCharacterEncoding()` on the wrapped `ResponseWriter` object.

      Specified by:
        `getCharacterEncoding` in class `ResponseWriter`
      Since:
        1.2
      See Also:
        `ResponseWriter.getCharacterEncoding()`

    - #### flush

          public void flush()
                     throws IOException

      The default behavior of this method is to call `ResponseWriter.flush()` on the wrapped `ResponseWriter` object.

      Specified by:
        `flush` in interface `Flushable`
      Specified by:
        `flush` in class `ResponseWriter`
      Throws:
        `IOException`
      Since:
        1.2
      See Also:
        `ResponseWriter.flush()`

    - #### startDocument

          public void startDocument()
                             throws IOException

      The default behavior of this method is to call `ResponseWriter.startDocument()` on the wrapped `ResponseWriter` object.

      Specified by:
        `startDocument` in class `ResponseWriter`
      Throws:
        `IOException` - if an input/output error occurs
      Since:
        1.2
      See Also:
        `ResponseWriter.startDocument()`

    - #### endDocument

          public void endDocument()
                           throws IOException

      The default behavior of this method is to call `ResponseWriter.endDocument()` on the wrapped `ResponseWriter` object.

      Specified by:
        `endDocument` in class `ResponseWriter`
      Throws:
        `IOException` - if an input/output error occurs
      Since:
        1.2
      See Also:
        `ResponseWriter.endDocument()`

    - #### startElement

          public void startElement(String name,
                          UIComponent component)
                            throws IOException

      The default behavior of this method is to call `ResponseWriter.startElement(String, javax.faces.component.UIComponent)` on the wrapped `ResponseWriter` object.

      Specified by:
        `startElement` in class `ResponseWriter`
      Parameters:
        `name` - Name of the element to be started
        `component` - 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.
      Throws:
        `IOException` - if an input/output error occurs
      Since:
        1.2
      See Also:
        `ResponseWriter.startElement(String, javax.faces.component.UIComponent)`

    - #### startCDATA

          public void startCDATA()
                          throws IOException

      The default behavior of this method is to call `ResponseWriter.startCDATA()` on the wrapped `ResponseWriter` object.

      Overrides:
        `startCDATA` in class `ResponseWriter`
      Throws:
        `IOException` - on any read/write error
      Since:
        2.0

    - #### endCDATA

          public void endCDATA()
                        throws IOException

      The default behavior of this method is to call `ResponseWriter.endCDATA()` on the wrapped `ResponseWriter` object.

      Overrides:
        `endCDATA` in class `ResponseWriter`
      Throws:
        `IOException` - on any read/write error
      Since:
        2.0

    - #### endElement

          public void endElement(String name)
                          throws IOException

      The default behavior of this method is to call `ResponseWriter.endElement(String)` on the wrapped `ResponseWriter` object.

      Specified by:
        `endElement` in class `ResponseWriter`
      Parameters:
        `name` - Name of the element to be ended
      Throws:
        `IOException` - on any read/write error
      Since:
        1.2
      See Also:
        `ResponseWriter.endElement(String)`

    - #### writeAttribute

          public void writeAttribute(String name,
                            Object value,
                            String property)
                              throws IOException

      The default behavior of this method is to call `ResponseWriter.writeAttribute(String, Object, String)` on the wrapped `ResponseWriter` object.

      Specified by:
        `writeAttribute` in class `ResponseWriter`
      Parameters:
        `name` - Attribute name to be added
        `value` - Attribute value to be added
        `property` - Name of the property or attribute (if any) of the `UIComponent` associated with the containing element, to which this generated attribute corresponds
      Throws:
        `IOException` - if an input/output error occurs
      Since:
        1.2
      See Also:
        `ResponseWriter.writeAttribute(String, Object, String)`

    - #### writeURIAttribute

          public void writeURIAttribute(String name,
                               Object value,
                               String property)
                                 throws IOException

      The default behavior of this method is to call `ResponseWriter.writeURIAttribute(String, Object, String)` on the wrapped `ResponseWriter` object.

      Specified by:
        `writeURIAttribute` in class `ResponseWriter`
      Parameters:
        `name` - Attribute name to be added
        `value` - Attribute value to be added
        `property` - Name of the property or attribute (if any) of the `UIComponent` associated with the containing element, to which this generated attribute corresponds
      Throws:
        `IOException` - if an input/output error occurs
      Since:
        1.2
      See Also:
        `ResponseWriter.writeURIAttribute(String, Object, String)`

    - #### writeComment

          public void writeComment(Object comment)
                            throws IOException

      The default behavior of this method is to call `ResponseWriter.writeComment(Object)` on the wrapped `ResponseWriter` object.

      Specified by:
        `writeComment` in class `ResponseWriter`
      Parameters:
        `comment` - Text content of the comment
      Throws:
        `IOException` - if an input/output error occurs
      Since:
        1.2
      See Also:
        `ResponseWriter.writeComment(Object)`

    - #### writeDoctype

          public void writeDoctype(String doctype)
                            throws IOException

      The default behavior of this method is to call `ResponseWriter.writeDoctype(java.lang.String)` on the wrapped `ResponseWriter` object.

      Overrides:
        `writeDoctype` in class `ResponseWriter`
      Parameters:
        `doctype` - Text content of the doctype
      Throws:
        `IOException` - if an input/output error occurs
      Since:
        2.2
      See Also:
        `ResponseWriter.writeDoctype(java.lang.String)`

    - #### writePreamble

          public void writePreamble(String preamble)
                             throws IOException

      The default behavior of this method is to call `ResponseWriter.writePreamble(java.lang.String)` on the wrapped `ResponseWriter` object.

      Overrides:
        `writePreamble` in class `ResponseWriter`
      Parameters:
        `preamble` - Text content of the preamble
      Throws:
        `IOException` - if an input/output error occurs
      Since:
        2.2
      See Also:
        `ResponseWriter.writePreamble(java.lang.String)`

    - #### writeText

          public void writeText(Object text,
                       String property)
                         throws IOException

      The default behavior of this method is to call `ResponseWriter.writeText(Object, String)` on the wrapped `ResponseWriter` object.

      Specified by:
        `writeText` in class `ResponseWriter`
      Parameters:
        `text` - Text to be written
        `property` - Name of the property or attribute (if any) of the `UIComponent` associated with the containing element, to which this generated text corresponds
      Throws:
        `IOException` - if an input/output error occurs
      Since:
        1.2
      See Also:
        `ResponseWriter.writeText(Object, String)`

    - #### writeText

          public void writeText(Object text,
                       UIComponent component,
                       String property)
                         throws IOException

      The default behavior of this method is to call `ResponseWriter.writeText(Object, UIComponent, String)` on the wrapped `ResponseWriter` object.

      Overrides:
        `writeText` in class `ResponseWriter`
      Parameters:
        `text` - Text to be written
        `component` - The `UIComponent` (if any) to which this element corresponds
        `property` - Name of the property or attribute (if any) of the `UIComponent` associated with the containing element, to which this generated text corresponds
      Throws:
        `IOException` - if an input/output error occurs
      Since:
        1.2
      See Also:
        `ResponseWriter.writeText(Object, String)`

    - #### writeText

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

      The default behavior of this method is to call `ResponseWriter.writeText(char[], int, int)` on the wrapped `ResponseWriter` object.

      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:
        `IOException` - if an input/output error occurs
      Since:
        1.2
      See Also:
        `ResponseWriter.writeText(char[], int, int)`

    - #### cloneWithWriter

          public ResponseWriter cloneWithWriter(Writer writer)

      The default behavior of this method is to call `ResponseWriter.cloneWithWriter(java.io.Writer)` on the wrapped `ResponseWriter` object.

      Specified by:
        `cloneWithWriter` in class `ResponseWriter`
      Parameters:
        `writer` - The `Writer` that is the output destination
      Since:
        1.2
      See Also:
        `ResponseWriter.cloneWithWriter(java.io.Writer)`

    - #### close

          public void close()
                     throws IOException

      The default behavior of this method is to call `Writer.close()` on the wrapped `ResponseWriter` object.

      Specified by:
        `close` in interface `Closeable`
      Specified by:
        `close` in interface `AutoCloseable`
      Specified by:
        `close` in class `Writer`
      Throws:
        `IOException`
      Since:
        1.2
      See Also:
        `Writer.close()`

    - #### write

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

      The default behavior of this method is to call `Writer.write(char[], int, int)` on the wrapped `ResponseWriter` object.

      Specified by:
        `write` in class `Writer`
      Throws:
        `IOException`
      Since:
        1.2
      See Also:
        `Writer.write(char[], int, int)`

Copyright © 1996-2013, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.