KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > faces > context > RequestParameterMap


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.cocoon.faces.context;
17
18 import org.apache.cocoon.environment.Request;
19
20 import java.util.Enumeration JavaDoc;
21 import java.util.HashSet JavaDoc;
22 import java.util.Set JavaDoc;
23
24 /**
25  * Request parameters map
26  *
27  * @author <a HREF="mailto:vgritsenko@apache.org">Vadim Gritsenko</a>
28  * @version CVS $Id: RequestParameterMap.java 46253 2004-09-17 14:36:29Z vgritsenko $
29  */

30 class RequestParameterMap extends BaseMap {
31
32     private Request request;
33
34
35     RequestParameterMap(Request request) {
36         this.request = request;
37     }
38
39     public Object JavaDoc get(Object JavaDoc key) {
40         return request.getParameter(key.toString());
41     }
42
43     public Set JavaDoc entrySet() {
44         Set JavaDoc entries = new HashSet JavaDoc();
45         for (Enumeration JavaDoc e = request.getParameterNames(); e.hasMoreElements();) {
46             String JavaDoc name = (String JavaDoc) e.nextElement();
47             entries.add(new BaseMap.Entry(name, request.getParameter(name)));
48         }
49
50         return entries;
51     }
52
53     public boolean equals(Object JavaDoc obj) {
54         if (obj == null || !(obj instanceof RequestParameterMap)) {
55             return false;
56         }
57
58         return super.equals(obj);
59     }
60 }
61
Popular Tags