javax.faces.context.FacesContextWrapper Maven / Gradle / Ivy
Show all versions of jboss-jsf-api_2.3_spec Show documentation
/*
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
package javax.faces.context;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.el.ELContext;
import javax.faces.FacesWrapper;
import javax.faces.application.Application;
import javax.faces.application.FacesMessage;
import javax.faces.application.ProjectStage;
import javax.faces.component.UIViewRoot;
import javax.faces.event.PhaseId;
import javax.faces.render.RenderKit;
/**
* 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 push the implementation being wrapped to the
* constructor and use {@link #getWrapped} to access the instance being wrapped.
*
* @since 2.0
*/
public abstract class FacesContextWrapper extends FacesContext implements FacesWrapper {
private FacesContext wrapped;
/**
* @deprecated Use the other constructor taking the implementation being wrapped.
*/
@Deprecated
public FacesContextWrapper() {
}
/**
* If this faces context 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 FacesContextWrapper(FacesContext wrapped) {
this.wrapped = wrapped;
}
@Override
public FacesContext getWrapped() {
return wrapped;
}
// ----------------------------------------------- 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()
*/
@Override
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()
*/
@Override
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()
*/
@Override
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()
*/
@Override
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()
*/
@Override
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)
*/
@Override
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()
*/
@Override
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()
*/
@Override
public boolean getRenderResponse() {
return getWrapped().getRenderResponse();
}
/**
* The default behavior of this method is to
* call {@link FacesContext#getResourceLibraryContracts}
* on the wrapped {@link FacesContext} object.
*
* @see javax.faces.context.FacesContext#getResourceLibraryContracts
*/
@Override
public List getResourceLibraryContracts() {
return getWrapped().getResourceLibraryContracts();
}
/**
* The default behavior of this method is to
* call {@link FacesContext#setResourceLibraryContracts}
* on the wrapped {@link FacesContext} object.
*
* @see javax.faces.context.FacesContext#setResourceLibraryContracts
*/
@Override
public void setResourceLibraryContracts(List contracts) {
getWrapped().setResourceLibraryContracts(contracts);
}
/**
* The default behavior of this method is to
* call {@link FacesContext#getResponseComplete()}
* on the wrapped {@link FacesContext} object.
*
* @see javax.faces.context.FacesContext#getResponseComplete()
*/
@Override
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()
*/
@Override
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)
*/
@Override
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()
*/
@Override
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)
*/
@Override
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()
*/
@Override
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)
*/
@Override
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)
*/
@Override
public void addMessage(String clientId, FacesMessage message) {
getWrapped().addMessage(clientId, message);
}
/**
* The default behavior of this method
* is to call {@link FacesContext#isReleased} on the wrapped {@link
* FacesContext} object.
*
* @see javax.faces.context.FacesContext#isReleased
* @since 2.1
*/
@Override
public boolean isReleased() {
return getWrapped().isReleased();
}
/**
* The default behavior of this method is to
* call {@link FacesContext#release()}
* on the wrapped {@link FacesContext} object.
*
* @see javax.faces.context.FacesContext#release()
*/
@Override
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()
*/
@Override
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()
*/
@Override
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