KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > web > portlet > util > PortletRequestWrapper


1 /*
2  * Copyright 2002-2006 the original author or authors.
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 package org.springframework.web.portlet.util;
18
19 import java.util.Enumeration JavaDoc;
20 import java.util.Locale JavaDoc;
21 import java.util.Map JavaDoc;
22 import java.security.Principal 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 import org.springframework.util.Assert;
32
33 /**
34  * Simple wrapper for a {@link javax.portlet.PortletRequest}, delegating all
35  * calls to the underlying request.
36  *
37  * <p>(In the style of the Servlet API's {@link javax.servlet.ServletRequestWrapper}.)
38  *
39  * @author Juergen Hoeller
40  * @since 2.0
41  * @see ActionRequestWrapper
42  * @see javax.servlet.ServletRequestWrapper
43  */

44 public class PortletRequestWrapper implements PortletRequest {
45
46     /** Original request that we're delegating to */
47     private final PortletRequest portletRequest;
48
49
50     /**
51      * Create a PortletRequestWrapper for the given {@link javax.portlet.PortletRequest}.
52      * @param request the original {@link javax.portlet.PortletRequest} to wrap
53      * @throws IllegalArgumentException if the supplied <code>request</code> is <code>null</code>
54      */

55     public PortletRequestWrapper(PortletRequest request) {
56         Assert.notNull(request, "Request is required");
57         this.portletRequest = request;
58     }
59
60
61     public boolean isWindowStateAllowed(WindowState state) {
62         return this.portletRequest.isWindowStateAllowed(state);
63     }
64
65     public boolean isPortletModeAllowed(PortletMode mode) {
66         return this.portletRequest.isPortletModeAllowed(mode);
67     }
68
69     public PortletMode getPortletMode() {
70         return this.portletRequest.getPortletMode();
71     }
72
73     public WindowState getWindowState() {
74         return this.portletRequest.getWindowState();
75     }
76
77     public PortletPreferences getPreferences() {
78         return this.portletRequest.getPreferences();
79     }
80
81     public PortletSession getPortletSession() {
82         return this.portletRequest.getPortletSession();
83     }
84
85     public PortletSession getPortletSession(boolean create) {
86         return this.portletRequest.getPortletSession(create);
87     }
88
89     public String JavaDoc getProperty(String JavaDoc name) {
90         return this.portletRequest.getProperty(name);
91     }
92
93     public Enumeration JavaDoc getProperties(String JavaDoc name) {
94         return this.portletRequest.getProperties(name);
95     }
96
97     public Enumeration JavaDoc getPropertyNames() {
98         return this.portletRequest.getPropertyNames();
99     }
100
101     public PortalContext getPortalContext() {
102         return this.portletRequest.getPortalContext();
103     }
104
105     public String JavaDoc getAuthType() {
106         return this.portletRequest.getAuthType();
107     }
108
109     public String JavaDoc getContextPath() {
110         return this.portletRequest.getContextPath();
111     }
112
113     public String JavaDoc getRemoteUser() {
114         return this.portletRequest.getRemoteUser();
115     }
116
117     public Principal JavaDoc getUserPrincipal() {
118         return this.portletRequest.getUserPrincipal();
119     }
120
121     public boolean isUserInRole(String JavaDoc role) {
122         return this.portletRequest.isUserInRole(role);
123     }
124
125     public Object JavaDoc getAttribute(String JavaDoc name) {
126         return this.portletRequest.getAttribute(name);
127     }
128
129     public Enumeration JavaDoc getAttributeNames() {
130         return this.portletRequest.getAttributeNames();
131     }
132
133     public String JavaDoc getParameter(String JavaDoc name) {
134         return this.portletRequest.getParameter(name);
135     }
136
137     public Enumeration JavaDoc getParameterNames() {
138         return this.portletRequest.getParameterNames();
139     }
140
141     public String JavaDoc[] getParameterValues(String JavaDoc name) {
142         return this.portletRequest.getParameterValues(name);
143     }
144
145     public Map JavaDoc getParameterMap() {
146         return this.portletRequest.getParameterMap();
147     }
148
149     public boolean isSecure() {
150         return this.portletRequest.isSecure();
151     }
152
153     public void setAttribute(String JavaDoc name, Object JavaDoc value) {
154         this.portletRequest.setAttribute(name, value);
155     }
156
157     public void removeAttribute(String JavaDoc name) {
158         this.portletRequest.removeAttribute(name);
159     }
160
161     public String JavaDoc getRequestedSessionId() {
162         return this.portletRequest.getRequestedSessionId();
163     }
164
165     public boolean isRequestedSessionIdValid() {
166         return this.portletRequest.isRequestedSessionIdValid();
167     }
168
169     public String JavaDoc getResponseContentType() {
170         return this.portletRequest.getResponseContentType();
171     }
172
173     public Enumeration JavaDoc getResponseContentTypes() {
174         return this.portletRequest.getResponseContentTypes();
175     }
176
177     public Locale JavaDoc getLocale() {
178         return this.portletRequest.getLocale();
179     }
180
181     public Enumeration JavaDoc getLocales() {
182         return this.portletRequest.getLocales();
183     }
184
185     public String JavaDoc getScheme() {
186         return this.portletRequest.getScheme();
187     }
188
189     public String JavaDoc getServerName() {
190         return this.portletRequest.getServerName();
191     }
192
193     public int getServerPort() {
194         return this.portletRequest.getServerPort();
195     }
196
197 }
198
Popular Tags