KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > myfaces > context > servlet > RequestHeaderMap


1 /*
2  * Copyright 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.myfaces.context.servlet;
17
18 import java.util.Enumeration JavaDoc;
19
20 import javax.servlet.http.HttpServletRequest JavaDoc;
21
22
23 /**
24  * HttpServletRequest headers as Map.
25  *
26  * @author Anton Koinov (latest modification by $Author: matze $)
27  * @version $Revision: 1.9 $ $Date: 2004/10/13 11:51:00 $
28  */

29 public class RequestHeaderMap extends AbstractAttributeMap
30 {
31     private final HttpServletRequest JavaDoc _httpServletRequest;
32
33     RequestHeaderMap(HttpServletRequest JavaDoc httpServletRequest)
34     {
35         _httpServletRequest = httpServletRequest;
36     }
37
38     protected Object JavaDoc getAttribute(String JavaDoc key)
39     {
40         return _httpServletRequest.getHeader(key);
41     }
42
43     protected void setAttribute(String JavaDoc key, Object JavaDoc value)
44     {
45         throw new UnsupportedOperationException JavaDoc(
46             "Cannot set HttpServletRequest Header");
47     }
48
49     protected void removeAttribute(String JavaDoc key)
50     {
51         throw new UnsupportedOperationException JavaDoc(
52             "Cannot remove HttpServletRequest Header");
53     }
54
55     protected Enumeration JavaDoc getAttributeNames()
56     {
57         return _httpServletRequest.getHeaderNames();
58     }
59 }
60
Popular Tags