1 /* 2 * Copyright 2002-2006 the original author or authors. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package org.springframework.webflow.context; 17 18 import org.springframework.webflow.core.collection.MutableAttributeMap; 19 import org.springframework.webflow.core.collection.ParameterMap; 20 import org.springframework.webflow.core.collection.SharedAttributeMap; 21 22 /** 23 * A facade that provides normalized access to an external system that has 24 * interacted with Spring Web Flow. 25 * <p> 26 * This context object provides a normalized interface for internal web flow 27 * artifacts to use to reason on and manipulate the state of an external actor 28 * calling into SWF to execute flows. It represents the context about a single, 29 * <i>external</i> client request to manipulate a flow execution. 30 * <p> 31 * The design of this interface was inspired by JSF's own ExternalContext 32 * abstraction and shares the same name for consistency. If a particular 33 * external client type does not support all methods defined by this interface, 34 * they can just be implemented as returning an empty map or <code>null</code>. 35 * 36 * @author Keith Donald 37 * @author Erwin Vervaet 38 */ 39 public interface ExternalContext { 40 41 /** 42 * Returns the path (or identifier) of the application that is executing. 43 * @return the application context path (e.g. "/myapp") 44 */ 45 public String getContextPath(); 46 47 /** 48 * Returns the path (or identifier) of the dispatcher <i>within</i> the 49 * application that dispatched this request. 50 * @return the dispatcher path (e.g. "/dispatcher") 51 */ 52 public String getDispatcherPath(); 53 54 /** 55 * Returns the path info of this external request. Could be null. 56 * @return the request path info (e.g. "/flows.htm") 57 */ 58 public String getRequestPathInfo(); 59 60 /** 61 * Provides access to the parameters associated with the user request that 62 * led to SWF being called. This map is expected to be immutable and cannot 63 * be changed. 64 * @return the immutable request parameter map 65 */ 66 public ParameterMap getRequestParameterMap(); 67 68 /** 69 * Provides access to the external request attribute map, providing a 70 * storage for data local to the current user request and accessible to both 71 * internal and external SWF artifacts. 72 * @return the mutable request attribute map 73 */ 74 public MutableAttributeMap getRequestMap(); 75 76 /** 77 * Provides access to the external session map, providing a storage for data 78 * local to the current user session and accessible to both internal and 79 * external SWF artifacts. 80 * @return the mutable session attribute map 81 */ 82 public SharedAttributeMap getSessionMap(); 83 84 /** 85 * Provides access to the <i>global</i> external session map, providing a storage for data 86 * globally accross the user session and accessible to both internal and 87 * external SWF artifacts. 88 * <p> 89 * Note: most external context implementations do not distinguish between the concept of a 90 * "local" user session scope and a "global" session scope. The Portlet world does, but 91 * not the Servlet for example. In those cases calling this method returns the same 92 * map as calling {@link #getSessionMap()}. 93 * @return the mutable global session attribute map 94 */ 95 public SharedAttributeMap getGlobalSessionMap(); 96 97 /** 98 * Provides access to the external application map, providing a storage for 99 * data local to the current user application and accessible to both 100 * internal and external SWF artifacts. 101 * @return the mutable application attribute map 102 */ 103 public SharedAttributeMap getApplicationMap(); 104 105 }