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.webapp.filter.portlet;
20  
21  import java.security.Principal;
22  import java.util.Enumeration;
23  import java.util.Locale;
24  import java.util.Map;
25  
26  import javax.portlet.PortalContext;
27  import javax.portlet.PortletMode;
28  import javax.portlet.PortletPreferences;
29  import javax.portlet.PortletRequest;
30  import javax.portlet.PortletSession;
31  import javax.portlet.WindowState;
32  import javax.servlet.ServletResponse;
33  
34  /**
35   * <p>
36   * NOTE: This class should be used(instantiated) only by 
37   * TomahawkFacesContextWrapper. By that reason, it could change
38   * in the future.
39   * </p>
40   * 
41   * @since 1.1.8
42   * @author Leonardo Uribe (latest modification by $Author: lu4242 $)
43   * @version $Revision: 782179 $ $Date: 2009-06-05 20:35:54 -0500 (Fri, 05 Jun 2009) $
44   */
45  public class PortletRequestWrapper implements PortletRequest
46  {
47  
48      public PortletRequestWrapper(PortletRequest request)
49      {
50          if(request == null)
51          {
52              throw new IllegalArgumentException("Request cannot be null");
53          } else
54          {
55              this.request = request;
56              return;
57          }
58      }
59      public PortletRequest getRequest()
60      {
61          return request;
62      }
63  
64      public void setRequest(PortletRequest response)
65      {
66          if(response == null)
67          {
68              throw new IllegalArgumentException("Response cannot be null");
69          } else
70          {
71              this.request = response;
72              return;
73          }
74      }
75      
76      private PortletRequest request;
77  
78      public Object getAttribute(String s)
79      {
80          return request.getAttribute(s);
81      }
82  
83      public Enumeration getAttributeNames()
84      {
85          return request.getAttributeNames();
86      }
87  
88      public String getAuthType()
89      {
90          return request.getAuthType();
91      }
92  
93      public String getContextPath()
94      {
95          return request.getContextPath();
96      }
97  
98      public Locale getLocale()
99      {
100         return request.getLocale();
101     }
102 
103     public Enumeration getLocales()
104     {
105         return request.getLocales();
106     }
107 
108     public String getParameter(String s)
109     {
110         return request.getParameter(s);
111     }
112 
113     public Map getParameterMap()
114     {
115         return request.getParameterMap();
116     }
117 
118     public Enumeration getParameterNames()
119     {
120         return request.getParameterNames();
121     }
122 
123     public String[] getParameterValues(String s)
124     {
125         return request.getParameterValues(s);
126     }
127 
128     public PortalContext getPortalContext()
129     {
130         return request.getPortalContext();
131     }
132 
133     public PortletMode getPortletMode()
134     {
135         return request.getPortletMode();
136     }
137 
138     public PortletSession getPortletSession()
139     {
140         return request.getPortletSession();
141     }
142 
143     public PortletSession getPortletSession(boolean flag)
144     {
145         return request.getPortletSession(flag);
146     }
147 
148     public PortletPreferences getPreferences()
149     {
150         return request.getPreferences();
151     }
152 
153     public Enumeration getProperties(String s)
154     {
155         return request.getProperties(s);
156     }
157 
158     public String getProperty(String s)
159     {
160         return request.getProperty(s);
161     }
162 
163     public Enumeration getPropertyNames()
164     {
165         return request.getPropertyNames();
166     }
167 
168     public String getRemoteUser()
169     {
170         return request.getRemoteUser();
171     }
172 
173     public String getRequestedSessionId()
174     {
175         return request.getRequestedSessionId();
176     }
177 
178     public String getResponseContentType()
179     {
180         return request.getResponseContentType();
181     }
182 
183     public Enumeration getResponseContentTypes()
184     {
185         return request.getResponseContentTypes();
186     }
187 
188     public String getScheme()
189     {
190         return request.getScheme();
191     }
192 
193     public String getServerName()
194     {
195         return request.getServerName();
196     }
197 
198     public int getServerPort()
199     {
200         return request.getServerPort();
201     }
202 
203     public Principal getUserPrincipal()
204     {
205         return request.getUserPrincipal();
206     }
207 
208     public WindowState getWindowState()
209     {
210         return request.getWindowState();
211     }
212 
213     public boolean isPortletModeAllowed(PortletMode portletmode)
214     {
215         return request.isPortletModeAllowed(portletmode);
216     }
217 
218     public boolean isRequestedSessionIdValid()
219     {
220         return request.isRequestedSessionIdValid();
221     }
222 
223     public boolean isSecure()
224     {
225         return request.isSecure();
226     }
227 
228     public boolean isUserInRole(String s)
229     {
230         return request.isUserInRole(s);
231     }
232 
233     public boolean isWindowStateAllowed(WindowState windowstate)
234     {
235         return request.isWindowStateAllowed(windowstate);
236     }
237 
238     public void removeAttribute(String s)
239     {
240         request.removeAttribute(s);
241     }
242 
243     public void setAttribute(String s, Object obj)
244     {
245         request.setAttribute(s, obj);
246     }
247 }