001    /*
002     * Licensed to the Apache Software Foundation (ASF) under one or more
003     * contributor license agreements.  See the NOTICE file distributed with
004     * this work for additional information regarding copyright ownership.
005     * The ASF licenses this file to You under the Apache License, Version 2.0
006     * (the "License"); you may not use this file except in compliance with
007     * the License.  You may obtain a copy of the License at
008     *
009     *     http://www.apache.org/licenses/LICENSE-2.0
010     *
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS,
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     * See the License for the specific language governing permissions and
015     * limitations under the License.
016     */
017    package org.apache.commons.chain.web;
018    
019    
020    import java.util.Map;
021    import org.apache.commons.chain.impl.ContextBase;
022    
023    
024    /**
025     * <p>Abstract base implementation of {@link org.apache.commons.chain.Context} that
026     * provides web based applications that use it a "generic" view of HTTP related
027     * requests and responses, without tying the application to a particular underlying
028     * Java API (such as servlets).  It is expected that a concrete subclass
029     * of {@link WebContext} for each API (such as
030     * {@link org.apache.commons.chain.web.servlet.ServletWebContext})
031     * will support adapting that particular API's implementation of request
032     * and response objects into this generic framework.</p>
033     *
034     * <p>The characteristics of a web request/response are made visible via
035     * a series of JavaBeans properties (and mapped to read-only attributes
036     * of the same name, as supported by {@link ContextBase}.</p>
037     *
038     * @author Craig R. McClanahan
039     * @version $Revision: 480477 $ $Date: 2006-11-29 08:34:52 +0000 (Wed, 29 Nov 2006) $
040     */
041    
042    public abstract class WebContext extends ContextBase {
043    
044    
045        // ---------------------------------------------------------- Public Methods
046    
047    
048        /**
049         * <p>Return a mutable <code>Map</code> that maps application scope
050         * attribute names to their values.</p>
051         *
052         * @return Application scope Map.
053         */
054        public abstract Map getApplicationScope();
055    
056    
057        /**
058         * <p>Return an immutable <code>Map</code> that maps header names to
059         * the first (or only) header value (as a String).  Header names must
060         * be matched in a case-insensitive manner.</p>
061         *
062         * @return Header values Map.
063         */
064        public abstract Map getHeader();
065    
066    
067        /**
068         * <p>Return an immutable <code>Map</code> that maps header names to
069         * the set of all values specified in the request (as a String array).
070         * Header names must be matched in a case-insensitive manner.</p>
071         *
072         * @return Header values Map.
073         */
074        public abstract Map getHeaderValues();
075    
076    
077        /**
078         * <p>Return an immutable <code>Map</code> that maps context application
079         * initialization parameters to their values.</p>
080         *
081         * @return Initialization parameter Map.
082         */
083        public abstract Map getInitParam();
084    
085    
086        /**
087         * <p>Return an immutable <code>Map</code> that maps request parameter
088         * names to the first (or only) value (as a String).</p>
089         *
090         * @return Request parameter Map.
091         */
092        public abstract Map getParam();
093    
094    
095        /**
096         * <p>Return an immutable <code>Map</code> that maps request parameter
097         * names to the set of all values (as a String array).</p>
098         *
099         * @return Request parameter Map.
100         */
101        public abstract Map getParamValues();
102    
103    
104        /**
105         * <p>Return an immutable <code>Map</code> that maps cookie names to
106         * the set of cookies specified in the request.
107         *
108         * @return Map of Cookies.
109         * @since Chain 1.1
110         */
111        public abstract Map getCookies();
112    
113    
114        /**
115         * <p>Return a mutable <code>Map</code> that maps request scope
116         * attribute names to their values.</p>
117         *
118         * @return Request scope Map.
119         */
120        public abstract Map getRequestScope();
121    
122    
123        /**
124         * <p>Return a mutable <code>Map</code> that maps session scope
125         * attribute names to their values.</p>
126         *
127         * @return Session scope Map.
128         */
129        public abstract Map getSessionScope();
130    
131    
132    }