1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.pluto.portlet;
21
22 import java.util.Enumeration;
23
24 import javax.portlet.PortalContext;
25 import javax.portlet.PortletMode;
26 import javax.portlet.PortletPreferences;
27 import javax.portlet.PortletRequest;
28 import javax.portlet.PortletSession;
29 import javax.portlet.WindowState;
30
31 public class PortletRequestWrapper extends javax.servlet.http.HttpServletRequestWrapper
32 implements PortletRequest
33 {
34
35 /***
36 * Creates a ServletRequest adaptor wrapping the given request object.
37 * @throws java.lang.IllegalArgumentException if the request is null.
38 */
39 public PortletRequestWrapper(PortletRequest portletRequest)
40 {
41 super((javax.servlet.http.HttpServletRequest)portletRequest);
42
43 if (portletRequest == null)
44 {
45 throw new IllegalArgumentException("Request cannot be null");
46 }
47 }
48
49
50 public boolean isWindowStateAllowed(WindowState state)
51 {
52 return this.getPortletRequest().isWindowStateAllowed(state);
53 }
54
55 public boolean isPortletModeAllowed(PortletMode mode)
56 {
57 return this.getPortletRequest().isPortletModeAllowed(mode);
58 }
59
60 public PortletMode getPortletMode()
61 {
62 return this.getPortletRequest().getPortletMode();
63 }
64
65 public WindowState getWindowState()
66 {
67 return this.getPortletRequest().getWindowState();
68 }
69
70 public PortletPreferences getPreferences()
71 {
72 return this.getPortletRequest().getPreferences();
73 }
74
75 public PortletSession getPortletSession()
76 {
77 return this.getPortletRequest().getPortletSession();
78 }
79
80 public PortletSession getPortletSession(boolean create)
81 {
82 return this.getPortletRequest().getPortletSession(create);
83 }
84
85 public String getProperty(String name)
86 {
87 return this.getPortletRequest().getProperty(name);
88 }
89
90 public Enumeration getProperties(String name)
91 {
92 return this.getPortletRequest().getProperties(name);
93 }
94
95 public Enumeration getPropertyNames()
96 {
97 return this.getPortletRequest().getPropertyNames();
98 }
99
100 public PortalContext getPortalContext()
101 {
102 return this.getPortletRequest().getPortalContext();
103 }
104
105 public java.lang.String getAuthType()
106 {
107 return this.getPortletRequest().getAuthType();
108 }
109
110 public String getContextPath()
111 {
112 return this.getPortletRequest().getContextPath();
113 }
114
115 public java.lang.String getRemoteUser()
116 {
117 return this.getPortletRequest().getRemoteUser();
118 }
119
120 public java.security.Principal getUserPrincipal()
121 {
122 return this.getPortletRequest().getUserPrincipal();
123 }
124
125 public boolean isUserInRole(java.lang.String role)
126 {
127 return this.getPortletRequest().isUserInRole(role);
128 }
129
130 public Object getAttribute(String name)
131 {
132 return this.getPortletRequest().getAttribute(name);
133 }
134
135 public java.util.Enumeration getAttributeNames()
136 {
137 return this.getPortletRequest().getAttributeNames();
138 }
139
140 public String getParameter(String name)
141 {
142 return this.getPortletRequest().getParameter(name);
143 }
144
145 public java.util.Enumeration getParameterNames()
146 {
147 return this.getPortletRequest().getParameterNames();
148 }
149
150 public String[] getParameterValues(String name)
151 {
152 return this.getPortletRequest().getParameterValues(name);
153 }
154
155 public java.util.Map getParameterMap()
156 {
157 return this.getPortletRequest().getParameterMap();
158 }
159
160 public boolean isSecure()
161 {
162 return this.getPortletRequest().isSecure();
163 }
164
165 public void setAttribute(String name, Object o)
166 {
167 this.getPortletRequest().setAttribute(name,o);
168 }
169
170 public void removeAttribute(String name)
171 {
172 this.getPortletRequest().removeAttribute(name);
173 }
174
175 public String getRequestedSessionId()
176 {
177 return this.getPortletRequest().getRequestedSessionId();
178 }
179
180 public boolean isRequestedSessionIdValid()
181 {
182 return this.getPortletRequest().isRequestedSessionIdValid();
183 }
184
185 public String getResponseContentType()
186 {
187 return this.getPortletRequest().getResponseContentType();
188 }
189
190 public java.util.Enumeration getResponseContentTypes()
191 {
192 return this.getPortletRequest().getResponseContentTypes();
193 }
194
195 public java.util.Locale getLocale()
196 {
197 return this.getPortletRequest().getLocale();
198 }
199
200 public java.util.Enumeration getLocales()
201 {
202 return this.getPortletRequest().getLocales();
203 }
204
205 public String getScheme()
206 {
207 return this.getPortletRequest().getScheme();
208 }
209
210 public String getServerName()
211 {
212 return this.getPortletRequest().getServerName();
213 }
214
215 public int getServerPort()
216 {
217 return this.getPortletRequest().getServerPort();
218 }
219
220
221
222
223 /***
224 * Return the wrapped ServletRequest object.
225 */
226 public PortletRequest getPortletRequest()
227 {
228 return (PortletRequest) super.getRequest();
229 }
230
231 /***
232 * Sets the request being wrapped.
233 * @throws java.lang.IllegalArgumentException if the request is null.
234 */
235 public void setRequest(PortletRequest request)
236 {
237 if (request == null)
238 {
239 throw new IllegalArgumentException("Request cannot be null");
240 }
241 setRequest((javax.servlet.http.HttpServletRequest)request);
242 }
243
244 }
245