View Javadoc

1   /*
2    * Copyright 1999-2004 The Apache Software Foundation
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.apache.commons.chain.web;
17  
18  
19  import java.util.Map;
20  import org.apache.commons.chain.impl.ContextBase;
21  
22  
23  /***
24   * <p>Abstract base implementation of {@link org.apache.commons.chain.Context} that
25   * provides web based applications that use it a "generic" view of HTTP related
26   * requests and responses, without tying the application to a particular underlying
27   * Java API (such as servlets).  It is expected that a concrete subclass
28   * of {@link WebContext} for each API (such as
29   * {@link org.apache.commons.chain.web.servlet.ServletWebContext})
30   * will support adapting that particular API's implementation of request
31   * and response objects into this generic framework.</p>
32   *
33   * <p>The characteristics of a web request/response are made visible via
34   * a series of JavaBeans properties (and mapped to read-only attributes
35   * of the same name, as supported by {@link ContextBase}.</p>
36   *
37   * @author Craig R. McClanahan
38   * @version $Revision: 411948 $ $Date: 2006-06-06 00:29:02 +0100 (Tue, 06 Jun 2006) $
39   */
40  
41  public abstract class WebContext extends ContextBase {
42  
43  
44      // ---------------------------------------------------------- Public Methods
45  
46  
47      /***
48       * <p>Return a mutable <code>Map</code> that maps application scope
49       * attribute names to their values.</p>
50       *
51       * @return Application scope Map.
52       */
53      public abstract Map getApplicationScope();
54  
55  
56      /***
57       * <p>Return an immutable <code>Map</code> that maps header names to
58       * the first (or only) header value (as a String).  Header names must
59       * be matched in a case-insensitive manner.</p>
60       *
61       * @return Header values Map.
62       */
63      public abstract Map getHeader();
64  
65  
66      /***
67       * <p>Return an immutable <code>Map</code> that maps header names to
68       * the set of all values specified in the request (as a String array).
69       * Header names must be matched in a case-insensitive manner.</p>
70       *
71       * @return Header values Map.
72       */
73      public abstract Map getHeaderValues();
74  
75  
76      /***
77       * <p>Return an immutable <code>Map</code> that maps context application
78       * initialization parameters to their values.</p>
79       *
80       * @return Initialization parameter Map.
81       */
82      public abstract Map getInitParam();
83  
84  
85      /***
86       * <p>Return an immutable <code>Map</code> that maps request parameter
87       * names to the first (or only) value (as a String).</p>
88       *
89       * @return Request parameter Map.
90       */
91      public abstract Map getParam();
92  
93  
94      /***
95       * <p>Return an immutable <code>Map</code> that maps request parameter
96       * names to the set of all values (as a String array).</p>
97       *
98       * @return Request parameter Map.
99       */
100     public abstract Map getParamValues();
101 
102 
103     /***
104      * <p>Return an immutable <code>Map</code> that maps cookie names to
105      * the set of cookies specified in the request.
106      *
107      * @return Map of Cookies.
108      * @since Chain 1.1
109      */
110     public abstract Map getCookies();
111 
112 
113     /***
114      * <p>Return a mutable <code>Map</code> that maps request scope
115      * attribute names to their values.</p>
116      *
117      * @return Request scope Map.
118      */
119     public abstract Map getRequestScope();
120 
121 
122     /***
123      * <p>Return a mutable <code>Map</code> that maps session scope
124      * attribute names to their values.</p>
125      *
126      * @return Session scope Map.
127      */
128     public abstract Map getSessionScope();
129 
130 
131 }