View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *     http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.commons.chain.web;
18  
19  
20  import java.util.Map;
21  import org.apache.commons.chain.impl.ContextBase;
22  
23  
24  /**
25   * <p>Abstract base implementation of {@link org.apache.commons.chain.Context} that
26   * provides web based applications that use it a "generic" view of HTTP related
27   * requests and responses, without tying the application to a particular underlying
28   * Java API (such as servlets).  It is expected that a concrete subclass
29   * of {@link WebContext} for each API (such as
30   * {@link org.apache.commons.chain.web.servlet.ServletWebContext})
31   * will support adapting that particular API's implementation of request
32   * and response objects into this generic framework.</p>
33   *
34   * <p>The characteristics of a web request/response are made visible via
35   * a series of JavaBeans properties (and mapped to read-only attributes
36   * of the same name, as supported by {@link ContextBase}.</p>
37   *
38   * @author Craig R. McClanahan
39   * @version $Revision: 480477 $ $Date: 2006-11-29 08:34:52 +0000 (Wed, 29 Nov 2006) $
40   */
41  
42  public abstract class WebContext extends ContextBase {
43  
44  
45      // ---------------------------------------------------------- Public Methods
46  
47  
48      /**
49       * <p>Return a mutable <code>Map</code> that maps application scope
50       * attribute names to their values.</p>
51       *
52       * @return Application scope Map.
53       */
54      public abstract Map getApplicationScope();
55  
56  
57      /**
58       * <p>Return an immutable <code>Map</code> that maps header names to
59       * the first (or only) header value (as a String).  Header names must
60       * be matched in a case-insensitive manner.</p>
61       *
62       * @return Header values Map.
63       */
64      public abstract Map getHeader();
65  
66  
67      /**
68       * <p>Return an immutable <code>Map</code> that maps header names to
69       * the set of all values specified in the request (as a String array).
70       * Header names must be matched in a case-insensitive manner.</p>
71       *
72       * @return Header values Map.
73       */
74      public abstract Map getHeaderValues();
75  
76  
77      /**
78       * <p>Return an immutable <code>Map</code> that maps context application
79       * initialization parameters to their values.</p>
80       *
81       * @return Initialization parameter Map.
82       */
83      public abstract Map getInitParam();
84  
85  
86      /**
87       * <p>Return an immutable <code>Map</code> that maps request parameter
88       * names to the first (or only) value (as a String).</p>
89       *
90       * @return Request parameter Map.
91       */
92      public abstract Map getParam();
93  
94  
95      /**
96       * <p>Return an immutable <code>Map</code> that maps request parameter
97       * names to the set of all values (as a String array).</p>
98       *
99       * @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 }