Class ResponseWriterWrapper
- java.lang.Object
-
- java.io.Writer
-
- jakarta.faces.context.ResponseWriter
-
- jakarta.faces.context.ResponseWriterWrapper
-
- All Implemented Interfaces:
FacesWrapper<ResponseWriter>,Closeable,Flushable,Appendable,AutoCloseable
- Direct Known Subclasses:
PartialResponseWriter
public abstract class ResponseWriterWrapper extends ResponseWriter implements FacesWrapper<ResponseWriter>
Provides a simple implementation of
ResponseWriterthat can be subclassed by developers wishing to provide specialized behavior to an existingResponseWriterinstance. The default implementation of all methods is to call through to the wrappedResponseWriter.Usage: extend this class and push the implementation being wrapped to the constructor and use
getWrapped()to access the instance being wrapped.- Since:
- 1.2
-
-
Constructor Summary
Constructors Constructor Description ResponseWriterWrapper()Deprecated.Use the other constructor taking the implementation being wrapped.ResponseWriterWrapper(ResponseWriter wrapped)If this response writer has been decorated, the implementation doing the decorating should push the implementation being wrapped to this constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ResponseWritercloneWithWriter(Writer writer)The default behavior of this method is to callResponseWriter.cloneWithWriter(java.io.Writer)on the wrappedResponseWriterobject.voidclose()The default behavior of this method is to callWriter.close()on the wrappedResponseWriterobject.voidendCDATA()The default behavior of this method is to callResponseWriter.endCDATA()on the wrappedResponseWriterobject.voidendDocument()The default behavior of this method is to callResponseWriter.endDocument()on the wrappedResponseWriterobject.voidendElement(String name)The default behavior of this method is to callResponseWriter.endElement(String)on the wrappedResponseWriterobject.voidflush()The default behavior of this method is to callResponseWriter.flush()on the wrappedResponseWriterobject.StringgetCharacterEncoding()The default behavior of this method is to callResponseWriter.getCharacterEncoding()on the wrappedResponseWriterobject.StringgetContentType()The default behavior of this method is to callResponseWriter.getContentType()on the wrappedResponseWriterobject.ResponseWritergetWrapped()A class that implements this interface uses this method to return an instance of the class being wrapped.voidstartCDATA()The default behavior of this method is to callResponseWriter.startCDATA()on the wrappedResponseWriterobject.voidstartDocument()The default behavior of this method is to callResponseWriter.startDocument()on the wrappedResponseWriterobject.voidstartElement(String name, UIComponent component)The default behavior of this method is to callResponseWriter.startElement(String, jakarta.faces.component.UIComponent)on the wrappedResponseWriterobject.voidwrite(char[] cbuf, int off, int len)The default behavior of this method is to callWriter.write(char[], int, int)on the wrappedResponseWriterobject.voidwriteAttribute(String name, Object value, String property)The default behavior of this method is to callResponseWriter.writeAttribute(String, Object, String)on the wrappedResponseWriterobject.voidwriteComment(Object comment)The default behavior of this method is to callResponseWriter.writeComment(Object)on the wrappedResponseWriterobject.voidwriteDoctype(String doctype)The default behavior of this method is to callResponseWriter.writeDoctype(java.lang.String)on the wrappedResponseWriterobject.voidwritePreamble(String preamble)The default behavior of this method is to callResponseWriter.writePreamble(java.lang.String)on the wrappedResponseWriterobject.voidwriteText(char[] text, int off, int len)The default behavior of this method is to callResponseWriter.writeText(char[], int, int)on the wrappedResponseWriterobject.voidwriteText(Object text, UIComponent component, String property)The default behavior of this method is to callResponseWriter.writeText(Object, UIComponent, String)on the wrappedResponseWriterobject.voidwriteText(Object text, String property)The default behavior of this method is to callResponseWriter.writeText(Object, String)on the wrappedResponseWriterobject.voidwriteURIAttribute(String name, Object value, String property)The default behavior of this method is to callResponseWriter.writeURIAttribute(String, Object, String)on the wrappedResponseWriterobject.
-
-
-
Constructor Detail
-
ResponseWriterWrapper
@Deprecated public ResponseWriterWrapper()
Deprecated.Use the other constructor taking the implementation being wrapped.
-
ResponseWriterWrapper
public ResponseWriterWrapper(ResponseWriter wrapped)
If this response writer has been decorated, the implementation doing the decorating should push the implementation being wrapped to this constructor. The
getWrapped()will then return the implementation being wrapped.- Parameters:
wrapped- The implementation being wrapped.- Since:
- 2.3
-
-
Method Detail
-
getWrapped
public ResponseWriter getWrapped()
Description copied from interface:FacesWrapperA class that implements this interface uses this method to return an instance of the class being wrapped.
- Specified by:
getWrappedin interfaceFacesWrapper<ResponseWriter>- Returns:
- the wrapped instance.
-
getContentType
public String getContentType()
The default behavior of this method is to call
ResponseWriter.getContentType()on the wrappedResponseWriterobject.- Specified by:
getContentTypein classResponseWriter- Returns:
- the content type
- Since:
- 1.2
- See Also:
ResponseWriter.getContentType()
-
getCharacterEncoding
public String getCharacterEncoding()
The default behavior of this method is to call
ResponseWriter.getCharacterEncoding()on the wrappedResponseWriterobject.- Specified by:
getCharacterEncodingin classResponseWriter- Returns:
- the character encoding
- Since:
- 1.2
- See Also:
ResponseWriter.getCharacterEncoding()
-
flush
public void flush() throws IOExceptionThe default behavior of this method is to call
ResponseWriter.flush()on the wrappedResponseWriterobject.- Specified by:
flushin interfaceFlushable- Specified by:
flushin classResponseWriter- Throws:
IOException- Since:
- 1.2
- See Also:
ResponseWriter.flush()
-
startDocument
public void startDocument() throws IOExceptionThe default behavior of this method is to call
ResponseWriter.startDocument()on the wrappedResponseWriterobject.- Specified by:
startDocumentin classResponseWriter- Throws:
IOException- if an input/output error occurs- Since:
- 1.2
- See Also:
ResponseWriter.startDocument()
-
endDocument
public void endDocument() throws IOExceptionThe default behavior of this method is to call
ResponseWriter.endDocument()on the wrappedResponseWriterobject.- Specified by:
endDocumentin classResponseWriter- 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, jakarta.faces.component.UIComponent)on the wrappedResponseWriterobject.- Specified by:
startElementin classResponseWriter- Parameters:
name- Name of the element to be startedcomponent- TheUIComponent(if any) to which this element corresponds. This component is inspected for its pass through attributes as described in the standard HTML_BASICRenderKitspecification.- Throws:
IOException- if an input/output error occurs- Since:
- 1.2
- See Also:
ResponseWriter.startElement(String, jakarta.faces.component.UIComponent)
-
startCDATA
public void startCDATA() throws IOExceptionThe default behavior of this method is to call
ResponseWriter.startCDATA()on the wrappedResponseWriterobject.- Overrides:
startCDATAin classResponseWriter- Throws:
IOException- on any read/write error- Since:
- 2.0
-
endCDATA
public void endCDATA() throws IOExceptionThe default behavior of this method is to call
ResponseWriter.endCDATA()on the wrappedResponseWriterobject.- Overrides:
endCDATAin classResponseWriter- 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 wrappedResponseWriterobject.- Specified by:
endElementin classResponseWriter- 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 wrappedResponseWriterobject.- Specified by:
writeAttributein classResponseWriter- Parameters:
name- Attribute name to be addedvalue- Attribute value to be addedproperty- Name of the property or attribute (if any) of theUIComponentassociated 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 wrappedResponseWriterobject.- Specified by:
writeURIAttributein classResponseWriter- Parameters:
name- Attribute name to be addedvalue- Attribute value to be addedproperty- Name of the property or attribute (if any) of theUIComponentassociated 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 wrappedResponseWriterobject.- Specified by:
writeCommentin classResponseWriter- 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 wrappedResponseWriterobject.- Overrides:
writeDoctypein classResponseWriter- 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 wrappedResponseWriterobject.- Overrides:
writePreamblein classResponseWriter- 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 wrappedResponseWriterobject.- Specified by:
writeTextin classResponseWriter- Parameters:
text- Text to be writtenproperty- Name of the property or attribute (if any) of theUIComponentassociated 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 wrappedResponseWriterobject.- Overrides:
writeTextin classResponseWriter- Parameters:
text- Text to be writtencomponent- TheUIComponent(if any) to which this element correspondsproperty- Name of the property or attribute (if any) of theUIComponentassociated 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 IOExceptionThe default behavior of this method is to call
ResponseWriter.writeText(char[], int, int)on the wrappedResponseWriterobject.- Specified by:
writeTextin classResponseWriter- Parameters:
text- Text to be writtenoff- 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 wrappedResponseWriterobject.- Specified by:
cloneWithWriterin classResponseWriter- Parameters:
writer- TheWriterthat is the output destination- Returns:
- the new
ResponseWriter - Since:
- 1.2
- See Also:
ResponseWriter.cloneWithWriter(java.io.Writer)
-
close
public void close() throws IOExceptionThe default behavior of this method is to call
Writer.close()on the wrappedResponseWriterobject.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classWriter- Throws:
IOException- Since:
- 1.2
- See Also:
Writer.close()
-
write
public void write(char[] cbuf, int off, int len) throws IOExceptionThe default behavior of this method is to call
Writer.write(char[], int, int)on the wrappedResponseWriterobject.- Specified by:
writein classWriter- Throws:
IOException- Since:
- 1.2
- See Also:
Writer.write(char[], int, int)
-
-