All Downloads are FREE. Search and download functionalities are using the official Maven repository.

javax.faces.context.ResponseWriterWrapper Maven / Gradle / Ivy

There is a newer version: 8.0.1
Show newest version
/*
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 *
 * Copyright (c) 1997-2017 Oracle and/or its affiliates. All rights reserved.
 *
 * The contents of this file are subject to the terms of either the GNU
 * General Public License Version 2 only ("GPL") or the Common Development
 * and Distribution License("CDDL") (collectively, the "License").  You
 * may not use this file except in compliance with the License.  You can
 * obtain a copy of the License at
 * https://glassfish.java.net/public/CDDL+GPL_1_1.html
 * or packager/legal/LICENSE.txt.  See the License for the specific
 * language governing permissions and limitations under the License.
 *
 * When distributing the software, include this License Header Notice in each
 * file and include the License file at packager/legal/LICENSE.txt.
 *
 * GPL Classpath Exception:
 * Oracle designates this particular file as subject to the "Classpath"
 * exception as provided by Oracle in the GPL Version 2 section of the License
 * file that accompanied this code.
 *
 * Modifications:
 * If applicable, add the following below the License Header, with the fields
 * enclosed by brackets [] replaced by your own identifying information:
 * "Portions Copyright [year] [name of copyright owner]"
 *
 * Contributor(s):
 * If you wish your version of this file to be governed by only the CDDL or
 * only the GPL Version 2, indicate your decision by adding "[Contributor]
 * elects to include this software in this distribution under the [CDDL or GPL
 * Version 2] license."  If you don't indicate a single choice of license, a
 * recipient has the option to distribute your version of this file under
 * either the CDDL, the GPL Version 2 or to extend the choice of license to
 * its licensees as provided above.  However, if you add GPL Version 2 code
 * and therefore, elected the GPL Version 2 license, then the option applies
 * only if the new code is made subject to such option by the copyright
 * holder.
 */

package javax.faces.context;

import java.io.IOException;
import java.io.Writer;

import javax.faces.FacesWrapper;
import javax.faces.component.UIComponent;

/**
 * 

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

* *

Usage: extend this class and push the implementation being wrapped to the * constructor and use {@link #getWrapped} to access the instance being wrapped.

* * @since 1.2 */ public abstract class ResponseWriterWrapper extends ResponseWriter implements FacesWrapper { private ResponseWriter wrapped; /** * @deprecated Use the other constructor taking the implementation being wrapped. */ @Deprecated public ResponseWriterWrapper() { } /** *

If this response writer has been decorated, * the implementation doing the decorating should push the implementation being wrapped to this constructor. * The {@link #getWrapped()} will then return the implementation being wrapped.

* * @param wrapped The implementation being wrapped. * @since 2.3 */ public ResponseWriterWrapper(ResponseWriter wrapped) { this.wrapped = wrapped; } @Override public ResponseWriter getWrapped() { return wrapped; } // -------------------------- Methods from javax.faces.context.ResponseWriter /** *

The default behavior of this method is to * call {@link ResponseWriter#getContentType()} * on the wrapped {@link ResponseWriter} object.

* * @see ResponseWriter#getContentType() * @since 1.2 */ @Override public String getContentType() { return getWrapped().getContentType(); } /** *

The default behavior of this method is to * call {@link ResponseWriter#getCharacterEncoding()} * on the wrapped {@link ResponseWriter} object.

* * @see ResponseWriter#getCharacterEncoding() * @since 1.2 */ @Override public String getCharacterEncoding() { return getWrapped().getCharacterEncoding(); } /** *

The default behavior of this method is to * call {@link ResponseWriter#flush()} * on the wrapped {@link ResponseWriter} object.

* * @see ResponseWriter#flush() * @since 1.2 */ @Override public void flush() throws IOException { getWrapped().flush(); } /** *

The default behavior of this method is to * call {@link ResponseWriter#startDocument()} * on the wrapped {@link ResponseWriter} object.

* * @see ResponseWriter#startDocument() * @since 1.2 */ @Override public void startDocument() throws IOException { getWrapped().startDocument(); } /** *

The default behavior of this method is to * call {@link ResponseWriter#endDocument()} * on the wrapped {@link ResponseWriter} object.

* * @see ResponseWriter#endDocument() * @since 1.2 */ @Override public void endDocument() throws IOException { getWrapped().endDocument(); } /** *

The default behavior of this method is to * call {@link ResponseWriter#startElement(String, javax.faces.component.UIComponent)} * on the wrapped {@link ResponseWriter} object.

* * @see ResponseWriter#startElement(String, javax.faces.component.UIComponent) * @since 1.2 */ @Override public void startElement(String name, UIComponent component) throws IOException { getWrapped().startElement(name, component); } /** *

The default behavior of this method * is to call {@link ResponseWriter#startCDATA} on the wrapped * {@link ResponseWriter} object.

* @since 2.0 * @throws IOException on any read/write error */ @Override public void startCDATA() throws IOException { getWrapped().startCDATA(); } /** *

The default behavior of this method * is to call {@link ResponseWriter#endCDATA} on the wrapped * {@link ResponseWriter} object.

* @since 2.0 * @throws IOException on any read/write error */ @Override public void endCDATA() throws IOException { getWrapped().endCDATA(); } /** *

The default behavior of this method is to * call {@link ResponseWriter#endElement(String)} * on the wrapped {@link ResponseWriter} object.

* * @see ResponseWriter#endElement(String) * @since 1.2 * @throws IOException on any read/write error */ @Override public void endElement(String name) throws IOException { getWrapped().endElement(name); } /** *

The default behavior of this method is to * call {@link ResponseWriter#writeAttribute(String, Object, String)} * on the wrapped {@link ResponseWriter} object.

* * @see ResponseWriter#writeAttribute(String, Object, String) * @since 1.2 */ @Override public void writeAttribute(String name, Object value, String property) throws IOException { getWrapped().writeAttribute(name, value, property); } /** *

The default behavior of this method is to * call {@link ResponseWriter#writeURIAttribute(String, Object, String)} * on the wrapped {@link ResponseWriter} object.

* * @see ResponseWriter#writeURIAttribute(String, Object, String) * @since 1.2 */ @Override public void writeURIAttribute(String name, Object value, String property) throws IOException { getWrapped().writeURIAttribute(name, value, property); } /** *

The default behavior of this method is to * call {@link ResponseWriter#writeComment(Object)} * on the wrapped {@link ResponseWriter} object.

* * @see ResponseWriter#writeComment(Object) * @since 1.2 */ @Override public void writeComment(Object comment) throws IOException { getWrapped().writeComment(comment); } /** *

The default behavior of this method is to * call {@link ResponseWriter#writeDoctype} * on the wrapped {@link ResponseWriter} object.

* * @see ResponseWriter#writeDoctype * @since 2.2 */ @Override public void writeDoctype(String doctype) throws IOException { getWrapped().writeDoctype(doctype); } /** *

The default behavior of this method is to * call {@link ResponseWriter#writePreamble} * on the wrapped {@link ResponseWriter} object.

* * @see ResponseWriter#writePreamble * @since 2.2 */ @Override public void writePreamble(String preamble) throws IOException { getWrapped().writePreamble(preamble); } /** *

The default behavior of this method is to * call {@link ResponseWriter#writeText(Object, String)} * on the wrapped {@link ResponseWriter} object.

* * @see ResponseWriter#writeText(Object, String) * @since 1.2 */ @Override public void writeText(Object text, String property) throws IOException { getWrapped().writeText(text, property); } /** *

The default behavior of this method is to * call {@link ResponseWriter#writeText(Object, UIComponent, String)} * on the wrapped {@link ResponseWriter} object.

* * @see ResponseWriter#writeText(Object, String) * @since 1.2 */ @Override public void writeText(Object text, UIComponent component, String property) throws IOException { getWrapped().writeText(text, component, property); } /** *

The default behavior of this method is to * call {@link ResponseWriter#writeText(char[], int, int)} * on the wrapped {@link ResponseWriter} object.

* * @see ResponseWriter#writeText(char[], int, int) * @since 1.2 */ @Override public void writeText(char[] text, int off, int len) throws IOException { getWrapped().writeText(text, off, len); } /** *

The default behavior of this method is to * call {@link ResponseWriter#cloneWithWriter(java.io.Writer)} * on the wrapped {@link ResponseWriter} object.

* * @see ResponseWriter#cloneWithWriter(java.io.Writer) * @since 1.2 */ @Override public ResponseWriter cloneWithWriter(Writer writer) { return getWrapped().cloneWithWriter(writer); } // --------------------------------------------- Methods from java.io.Writer /** *

The default behavior of this method is to * call {@link ResponseWriter#close()} * on the wrapped {@link ResponseWriter} object.

* * @see ResponseWriter#close() * @since 1.2 */ @Override public void close() throws IOException { getWrapped().close(); } /** *

The default behavior of this method is to * call {@link ResponseWriter#write(char[], int, int)} * on the wrapped {@link ResponseWriter} object.

* * @see ResponseWriter#write(char[], int, int) * @since 1.2 */ @Override public void write(char[] cbuf, int off, int len) throws IOException { getWrapped().write(cbuf, off, len); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy