View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.myfaces.context.portlet;
20  
21  import java.util.Enumeration;
22  import java.util.Map;
23  
24  import javax.portlet.PortletRequest;
25  
26  import org.apache.myfaces.util.AbstractAttributeMap;
27  
28  
29  
30  /**
31   * PortletRequest headers as Map.
32   *
33   * @author  Stan Silvert (latest modification by $Author: lu4242 $)
34   * @version $Revision: 1000660 $ $Date: 2010-09-23 18:02:43 -0500 (Thu, 23 Sep 2010) $
35   */
36  public class RequestHeaderMap extends AbstractAttributeMap
37  {
38      private final PortletRequest _portletRequest;
39  
40      RequestHeaderMap(PortletRequest portletRequest)
41      {
42          _portletRequest = portletRequest;
43      }
44  
45      protected Object getAttribute(String key)
46      {
47          return _portletRequest.getProperty(key);
48      }
49  
50      protected void setAttribute(String key, Object value)
51      {
52          throw new UnsupportedOperationException(
53              "Cannot set PortletRequest property");
54      }
55  
56      protected void removeAttribute(String key)
57      {
58          throw new UnsupportedOperationException(
59              "Cannot remove PortletRequest property");
60      }
61  
62      protected Enumeration getAttributeNames()
63      {
64          return _portletRequest.getPropertyNames();
65      }
66  
67      public void putAll(Map t)
68      {
69          throw new UnsupportedOperationException();
70      }
71  
72  
73      public void clear()
74      {
75          throw new UnsupportedOperationException();
76      }    
77  }