javax.faces.context.FacesContextWrapper Maven / Gradle / Ivy
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2009 Sun Microsystems, Inc. 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.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/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 glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [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.util.Iterator;
import java.util.Map;
import java.util.List;
import javax.faces.FacesWrapper;
import javax.faces.event.PhaseId;
import javax.faces.component.UIViewRoot;
import javax.faces.render.RenderKit;
import javax.faces.application.Application;
import javax.faces.application.FacesMessage;
import javax.faces.application.ProjectStage;
import javax.el.ELContext;
/**
* Provides a simple implementation of {@link FacesContext} that can
* be subclassed by developers wishing to provide specialized behavior
* to an existing {@link FacesContext} instance. The default
* implementation of all methods is to call through to the wrapped
* {@link FacesContext} instance.
*
* Usage: extend this class and override {@link #getWrapped} to
* return the instance being wrapping.
*
* @since 2.0
*/
public abstract class FacesContextWrapper extends FacesContext implements FacesWrapper {
// ----------------------------------------------- Methods from FacesWrapper
/**
* @return the wrapped {@link FacesContext} instance
* @see javax.faces.FacesWrapper#getWrapped()
*/
public abstract FacesContext getWrapped();
// ----------------------------------------------- Methods from FacesContext
/**
* The default behavior of this method is to
* call {@link FacesContext#getApplication()}
* on the wrapped {@link FacesContext} object.
*
* @see javax.faces.context.FacesContext#getApplication()
*/
public Application getApplication() {
return getWrapped().getApplication();
}
/**
* The default behavior of this method is to
* call {@link javax.faces.context.FacesContext#getClientIdsWithMessages()}
* on the wrapped {@link FacesContext} object.
*
* @see FacesContext#getClientIdsWithMessages()
*/
public Iterator getClientIdsWithMessages() {
return getWrapped().getClientIdsWithMessages();
}
/**
* The default behavior of this method is to
* call {@link FacesContext#getExternalContext()}
* on the wrapped {@link FacesContext} object.
*
* @see javax.faces.context.FacesContext#getExternalContext()
*/
public ExternalContext getExternalContext() {
return getWrapped().getExternalContext();
}
/**
* The default behavior of this method is to
* call {@link FacesContext#getMaximumSeverity()}
* on the wrapped {@link FacesContext} object.
*
* @see javax.faces.context.FacesContext#getMaximumSeverity()
*/
public FacesMessage.Severity getMaximumSeverity() {
return getWrapped().getMaximumSeverity();
}
/**
* The default behavior of this method is to
* call {@link FacesContext#getMessages()}
* on the wrapped {@link FacesContext} object.
*
* @see javax.faces.context.FacesContext#getMessages()
*/
public Iterator getMessages() {
return getWrapped().getMessages();
}
/**
* The default behavior of this method is to
* call {@link FacesContext#getMessages(String)}
* on the wrapped {@link FacesContext} object.
*
* @see javax.faces.context.FacesContext#getMessages(String)
*/
public Iterator getMessages(String clientId) {
return getWrapped().getMessages(clientId);
}
/**
* The default behavior of this method is to
* call {@link FacesContext#getRenderKit()}
* on the wrapped {@link FacesContext} object.
*
* @see javax.faces.context.FacesContext#getRenderKit()
*/
public RenderKit getRenderKit() {
return getWrapped().getRenderKit();
}
/**
* The default behavior of this method is to
* call {@link FacesContext#getRenderResponse()}
* on the wrapped {@link FacesContext} object.
*
* @see javax.faces.context.FacesContext#getRenderResponse()
*/
public boolean getRenderResponse() {
return getWrapped().getRenderResponse();
}
/**
* The default behavior of this method is to
* call {@link FacesContext#getResponseComplete()}
* on the wrapped {@link FacesContext} object.
*
* @see javax.faces.context.FacesContext#getResponseComplete()
*/
public boolean getResponseComplete() {
return getWrapped().getResponseComplete();
}
/**
* The default behavior of this method is to
* call {@link FacesContext#getResponseStream()}
* on the wrapped {@link FacesContext} object.
*
* @see javax.faces.context.FacesContext#getResponseStream()
*/
public ResponseStream getResponseStream() {
return getWrapped().getResponseStream();
}
/**
* The default behavior of this method is to
* call {@link FacesContext#setResponseStream(ResponseStream)}
* on the wrapped {@link FacesContext} object.
*
* @see javax.faces.context.FacesContext#setResponseStream(ResponseStream)
*/
public void setResponseStream(ResponseStream responseStream) {
getWrapped().setResponseStream(responseStream);
}
/**
* The default behavior of this method is to
* call {@link FacesContext#getResponseWriter()}
* on the wrapped {@link FacesContext} object.
*
* @see javax.faces.context.FacesContext#getResponseWriter()
*/
public ResponseWriter getResponseWriter() {
return getWrapped().getResponseWriter();
}
/**
* The default behavior of this method is to
* call {@link FacesContext#setResponseWriter(ResponseWriter)}
* on the wrapped {@link FacesContext} object.
*
* @see javax.faces.context.FacesContext#setResponseWriter(ResponseWriter)
*/
public void setResponseWriter(ResponseWriter responseWriter) {
getWrapped().setResponseWriter(responseWriter);
}
/**
* The default behavior of this method is to
* call {@link FacesContext#getViewRoot()}
* on the wrapped {@link FacesContext} object.
*
* @see javax.faces.context.FacesContext#getViewRoot()
*/
public UIViewRoot getViewRoot() {
return getWrapped().getViewRoot();
}
/**
* The default behavior of this method is to
* call {@link FacesContext#setViewRoot(UIViewRoot)}
* on the wrapped {@link FacesContext} object.
*
* @see javax.faces.context.FacesContext#setViewRoot(UIViewRoot)
*/
public void setViewRoot(UIViewRoot root) {
getWrapped().setViewRoot(root);
}
/**
* The default behavior of this method is to
* call {@link FacesContext#addMessage(String, FacesMessage)}
* on the wrapped {@link FacesContext} object.
*
* @see javax.faces.context.FacesContext#addMessage(String, FacesMessage)
*/
public void addMessage(String clientId, FacesMessage message) {
getWrapped().addMessage(clientId, message);
}
/**
* The default behavior of this method is to
* call {@link FacesContext#release()}
* on the wrapped {@link FacesContext} object.
*
* @see javax.faces.context.FacesContext#release()
*/
public void release() {
getWrapped().release();
}
/**
* The default behavior of this method is to
* call {@link FacesContext#renderResponse()}
* on the wrapped {@link FacesContext} object.
*
* @see javax.faces.context.FacesContext#renderResponse()
*/
public void renderResponse() {
getWrapped().renderResponse();
}
/**
* The default behavior of this method is to
* call {@link FacesContext#responseComplete()}
* on the wrapped {@link FacesContext} object.
*
* @see javax.faces.context.FacesContext#responseComplete()
*/
public void responseComplete() {
getWrapped().responseComplete();
}
/**
* The default behavior of this method is to
* call {@link FacesContext#getAttributes()}
* on the wrapped {@link FacesContext} object.
*
* @see javax.faces.context.FacesContext#getAttributes()
*/
@Override
public Map