KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > pluto > portlet > PortletRequestWrapper


1 /*
2  * Copyright 2003,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 /*
17
18  */

19
20 package org.apache.pluto.portlet;
21
22 import java.util.Enumeration JavaDoc;
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 JavaDoc
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 JavaDoc)portletRequest);
42
43         if (portletRequest == null)
44         {
45             throw new IllegalArgumentException JavaDoc("Request cannot be null");
46         }
47     }
48
49     // javax.portlet.PortletRequest implementation -------------------------------------------------
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 JavaDoc getProperty(String JavaDoc name)
86     {
87         return this.getPortletRequest().getProperty(name);
88     }
89
90     public Enumeration JavaDoc getProperties(String JavaDoc name)
91     {
92         return this.getPortletRequest().getProperties(name);
93     }
94
95     public Enumeration JavaDoc 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 JavaDoc getAuthType()
106     {
107         return this.getPortletRequest().getAuthType();
108     }
109
110     public String JavaDoc getContextPath()
111     {
112         return this.getPortletRequest().getContextPath();
113     }
114
115     public java.lang.String JavaDoc getRemoteUser()
116     {
117         return this.getPortletRequest().getRemoteUser();
118     }
119
120     public java.security.Principal JavaDoc getUserPrincipal()
121     {
122         return this.getPortletRequest().getUserPrincipal();
123     }
124
125     public boolean isUserInRole(java.lang.String JavaDoc role)
126     {
127         return this.getPortletRequest().isUserInRole(role);
128     }
129
130     public Object JavaDoc getAttribute(String JavaDoc name)
131     {
132         return this.getPortletRequest().getAttribute(name);
133     }
134
135     public java.util.Enumeration JavaDoc getAttributeNames()
136     {
137         return this.getPortletRequest().getAttributeNames();
138     }
139
140     public String JavaDoc getParameter(String JavaDoc name)
141     {
142         return this.getPortletRequest().getParameter(name);
143     }
144     
145     public java.util.Enumeration JavaDoc getParameterNames()
146     {
147         return this.getPortletRequest().getParameterNames();
148     }
149     
150     public String JavaDoc[] getParameterValues(String JavaDoc name)
151     {
152         return this.getPortletRequest().getParameterValues(name);
153     }
154
155     public java.util.Map JavaDoc 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 JavaDoc name, Object JavaDoc o)
166     {
167         this.getPortletRequest().setAttribute(name,o);
168     }
169    
170     public void removeAttribute(String JavaDoc name)
171     {
172         this.getPortletRequest().removeAttribute(name);
173     }
174     
175     public String JavaDoc getRequestedSessionId()
176     {
177         return this.getPortletRequest().getRequestedSessionId();
178     }
179
180     public boolean isRequestedSessionIdValid()
181     {
182         return this.getPortletRequest().isRequestedSessionIdValid();
183     }
184     
185     public String JavaDoc getResponseContentType()
186     {
187         return this.getPortletRequest().getResponseContentType();
188     }
189     
190     public java.util.Enumeration JavaDoc getResponseContentTypes()
191     {
192         return this.getPortletRequest().getResponseContentTypes();
193     }
194     
195     public java.util.Locale JavaDoc getLocale()
196     {
197         return this.getPortletRequest().getLocale();
198     }
199     
200     public java.util.Enumeration JavaDoc getLocales()
201     {
202         return this.getPortletRequest().getLocales();
203     }
204
205     public String JavaDoc getScheme()
206     {
207         return this.getPortletRequest().getScheme();
208     }
209     
210     public String JavaDoc getServerName()
211     {
212         return this.getPortletRequest().getServerName();
213     }
214     
215     public int getServerPort()
216     {
217         return this.getPortletRequest().getServerPort();
218     }
219
220     // --------------------------------------------------------------------------------------------
221

222     // additional methods -------------------------------------------------------------------------
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 JavaDoc("Request cannot be null");
240         }
241         setRequest((javax.servlet.http.HttpServletRequest JavaDoc)request);
242     }
243     // --------------------------------------------------------------------------------------------
244
}
245
246
Popular Tags