1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.portals.bridges.jsf;
18
19 import javax.servlet.http.HttpServletRequest;
20 import java.util.Enumeration;
21
22 /***
23 * <p>
24 * This must be the set of properties available via the javax.portlet.PortletRequest methods getProperty()
25 * and getPropertyNames(). As such, HTTP headers will only be included if they were provided by the portlet container,
26 * and additional properties provided by the portlet container may also be included.
27 * @author Apache MyFaces team
28 */
29 public class ServletRequestHeaderMap extends AbstractAttributeMap
30 {
31 /*** The portlet request. */
32 private final HttpServletRequest servletRequest;
33
34 /***
35 * @param portletRequest The {@link javax.portlet.PortletRequest}.
36 */
37 ServletRequestHeaderMap(HttpServletRequest portletRequest)
38 {
39 this.servletRequest = portletRequest;
40 }
41
42 /***
43 * @see AbstractAttributeMap#getAttribute(String)
44 */
45 protected Object getAttribute(String key)
46 {
47 return servletRequest.getHeader(key);
48 }
49
50 /***
51 * @see AbstractAttributeMap#setAttribute(String, Object)
52 */
53 protected void setAttribute(String key, Object value)
54 {
55 throw new UnsupportedOperationException(
56 "Cannot set PortletRequest Property");
57 }
58
59 /***
60 * @see AbstractAttributeMap#removeAttribute(String)
61 */
62 protected void removeAttribute(String key)
63 {
64 throw new UnsupportedOperationException(
65 "Cannot remove PortletRequest Property");
66 }
67
68 /***
69 * @see AbstractAttributeMap#getAttributeNames()
70 */
71 protected Enumeration getAttributeNames()
72 {
73 return servletRequest.getHeaderNames();
74 }
75 }