1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 */ 19 package org.apache.myfaces.lifecycle; 20 21 import javax.faces.component.UIComponent; 22 import javax.faces.context.FacesContext; 23 24 /** 25 * Support class for restore view phase 26 * 27 * @author Mathias Broekelmann (latest modification by $Author$) 28 * @version $Revision$ $Date$ 29 */ 30 public interface RestoreViewSupport 31 { 32 /** 33 * <p> 34 * Calculates the view id from the given faces context by the following algorithm 35 * </p> 36 * <ul> 37 * <li>lookup the viewid from the request attribute "javax.servlet.include.path_info" 38 * <li>if null lookup the value for viewid by {@link javax.faces.context.ExternalContext#getRequestPathInfo()} 39 * <li>if null lookup the value for viewid from the request attribute "javax.servlet.include.servlet_path" 40 * <li>if null lookup the value for viewid by {@link javax.faces.context.ExternalContext#getRequestServletPath()} 41 * <li>if null throw a {@link javax.faces.FacesException} 42 * </ul> 43 */ 44 String calculateViewId(FacesContext facesContext); 45 46 /** 47 * Derive a view id retrieved from calling calculateViewId(FacesContext), but 48 * do not check if a resource with this name exists. This method is useful 49 * to retrieve a VDL instance, but note there are some cases (TCK test) where 50 * it is expected in Restore View algorithm a null or dummy viewId is passed. 51 * 52 * @deprecated Use ViewHandler.deriveLogicalViewId 53 * @param context 54 * @param viewId 55 * @return 56 */ 57 @Deprecated 58 String deriveViewId(FacesContext context, String viewId); 59 60 /** 61 * Processes the component tree. For each component (including the given one) in the tree determine if a value 62 * expression for the attribute "binding" is defined. If the expression is not null set the component instance to 63 * the value of this expression 64 * 65 * @param facesContext 66 * @param component 67 * the root component 68 */ 69 void processComponentBinding(FacesContext facesContext, UIComponent component); 70 71 /** 72 * <p> 73 * Determine if the current request is a post back by the following algorithm. 74 * </p> 75 * <p> 76 * Find the render-kit-id for the current request by calling calculateRenderKitId() on the Application’s 77 * ViewHandler. Get that RenderKit’s ResponseStateManager and call its isPostback() method, passing the given 78 * FacesContext. 79 * </p> 80 * 81 * @param facesContext 82 * @return 83 */ 84 boolean isPostback(FacesContext facesContext); 85 86 /** 87 * Check if a view exists 88 * 89 * @param facesContext 90 * @param viewId 91 * @return 92 */ 93 boolean checkViewExists(FacesContext facesContext, String viewId); 94 }