org.apache.myfaces.trinidad.context.PageFlowScopeProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of trinidad-api Show documentation
Show all versions of trinidad-api Show documentation
Public API for the Apache MyFaces Trinidad project
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.myfaces.trinidad.context;
import java.util.Map;
import javax.faces.context.FacesContext;
/**
* Abstract implementation for code that provides page flow scopes; this
* may be overridden.
*
* To override this, provide a file on the classpath at
* /META-INF/services/org.apache.myfaces.trinidad.context.PageFlowScopeProvider
* with the name of the alternative implementation. (There's no current
* support for decoration, and this general approach may be revisited
* in the future.)
*
*/
public abstract class PageFlowScopeProvider
{
/**
*/
protected PageFlowScopeProvider()
{
}
/**
* Returns the current PageFlowScope, including any calls
* to pushPageFlowScope()
or popPageFlowScope()
.
*
* @param context the current FacesContext
*/
public abstract Map getPageFlowScope(FacesContext context);
/**
* Pushes a new process scope onto the stack.
*
* @param context the current FacesContext
* @param copyParent if true, all values from the parent process
* scope will be copied into the new process scope.
* @return the new scope
*/
public abstract Map pushPageFlowScope(
FacesContext context,
boolean copyParent);
/**
* Pushes a new process scope onto the stack.
*
* @param context the current FacesContext
* @param discardScope if true, the scope will be immediately destroyed.
* if false, the scope may be available (for back button use, for
* example), but this is at the discretion of the implementation,
* which may aggressively destroy page flow scopes in some circumstances.
*/
public abstract Map popPageFlowScope(FacesContext context, boolean discardScope);
/**
* Encode the page flow scope into the current URL for processing
* in later requests.
*
* @param context the current FacesContext
* @param url an URL (which may already contain query parameters)
*/
public abstract String encodeCurrentPageFlowScopeURL(
FacesContext context,
String url);
/**
* Encode the page flow scope into the dialog URL
*
* Note that the Dialog Framework may first call ViewHandler.getActionURL(), which in turn will
* call encodeCurrentPageFlowScopeURL(). Then this method will be given a chance to encode any dialog-specific
* information. The dafault implementation does not modify the URL.
*
* @param context the current FacesContext
* @param url an URL (which may already contain query parameters)
* @return encoded URL
*/
public String encodeDialogPageFlowScopeURL(
FacesContext context,
String url)
{
return url;
}
}