I'm not crazy about this API. I'd rather have AdfFacesContext.isPartialRequest().
Anyone else agree? -- Adam On 7/20/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Author: matzew Date: Thu Jul 20 10:51:25 2006 New Revision: 424003 URL: http://svn.apache.org/viewvc?rev=424003&view=rev Log: Fixed ADFFACES-70; Created PartitialPageRenderingUtils and made PartialPageUtils final, since it already has a private constructor. inside isPartialReq() the method from PartitialPageRenderingUtils clazz is used Added: incubator/adffaces/trunk/adf-faces/adf-faces-api/src/main/java/org/apache/myfaces/adf/util/PartitialPageRenderingUtils.java (with props) Added: incubator/adffaces/trunk/adf-faces/adf-faces-api/src/main/java/org/apache/myfaces/adf/util/PartitialPageRenderingUtils.java URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/adf-faces/adf-faces-api/src/main/java/org/apache/myfaces/adf/util/PartitialPageRenderingUtils.java?rev=424003&view=auto ============================================================================== --- incubator/adffaces/trunk/adf-faces/adf-faces-api/src/main/java/org/apache/myfaces/adf/util/PartitialPageRenderingUtils.java (added) +++ incubator/adffaces/trunk/adf-faces/adf-faces-api/src/main/java/org/apache/myfaces/adf/util/PartitialPageRenderingUtils.java Thu Jul 20 10:51:25 2006 @@ -0,0 +1,61 @@ +/* + * Copyright 2006 The Apache Software Foundation. + * + * Licensed 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.adf.util; + +import java.util.Map; + +import javax.faces.context.FacesContext; + +/** + * Utility methods for Renderers which support partial page rendering. + * <p> + * @author The Apache Trinidad Podling + */ +public final class PartitialPageRenderingUtils +{ + + private PartitialPageRenderingUtils() + { + + } + + /** + * Utility method to indicate if this current HTTP request is a + * partial page rendering request. + * + * @param context the <code>FacesContext</code> object for + * the request we are processing + * @return is this request a PPR request? + */ + public static boolean isPartialRequest(FacesContext context) + { + Map requestMap = context.getExternalContext().getRequestMap(); + if (Boolean.TRUE.equals(requestMap.get(_PARTIAL_KEY))) + return true; + + Map parameters = context.getExternalContext().getRequestParameterMap(); + if ("true".equals(parameters.get("partial"))) + return true; + + return false; + } + + /* + * key, used for the PPR feature, inside the internal API. + */ + private static final String _PARTIAL_KEY = + "org.apache.myfaces.adfinternal.ForcedPartialRequest"; +} \ No newline at end of file Propchange: incubator/adffaces/trunk/adf-faces/adf-faces-api/src/main/java/org/apache/myfaces/adf/util/PartitialPageRenderingUtils.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/adffaces/trunk/adf-faces/adf-faces-api/src/main/java/org/apache/myfaces/adf/util/PartitialPageRenderingUtils.java ------------------------------------------------------------------------------ svn:keywords = Date Author Id Revision HeadURL