001: /*
002: * Copyright 2002-2006 the original author or authors.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016:
017: package org.springframework.web.portlet.util;
018:
019: import java.util.Enumeration;
020: import java.util.Locale;
021: import java.util.Map;
022: import java.security.Principal;
023:
024: import javax.portlet.PortalContext;
025: import javax.portlet.PortletMode;
026: import javax.portlet.PortletPreferences;
027: import javax.portlet.PortletRequest;
028: import javax.portlet.PortletSession;
029: import javax.portlet.WindowState;
030:
031: import org.springframework.util.Assert;
032:
033: /**
034: * Simple wrapper for a {@link javax.portlet.PortletRequest}, delegating all
035: * calls to the underlying request.
036: *
037: * <p>(In the style of the Servlet API's {@link javax.servlet.ServletRequestWrapper}.)
038: *
039: * @author Juergen Hoeller
040: * @since 2.0
041: * @see ActionRequestWrapper
042: * @see javax.servlet.ServletRequestWrapper
043: */
044: public class PortletRequestWrapper implements PortletRequest {
045:
046: /** Original request that we're delegating to */
047: private final PortletRequest portletRequest;
048:
049: /**
050: * Create a PortletRequestWrapper for the given {@link javax.portlet.PortletRequest}.
051: * @param request the original {@link javax.portlet.PortletRequest} to wrap
052: * @throws IllegalArgumentException if the supplied <code>request</code> is <code>null</code>
053: */
054: public PortletRequestWrapper(PortletRequest request) {
055: Assert.notNull(request, "Request is required");
056: this .portletRequest = request;
057: }
058:
059: public boolean isWindowStateAllowed(WindowState state) {
060: return this .portletRequest.isWindowStateAllowed(state);
061: }
062:
063: public boolean isPortletModeAllowed(PortletMode mode) {
064: return this .portletRequest.isPortletModeAllowed(mode);
065: }
066:
067: public PortletMode getPortletMode() {
068: return this .portletRequest.getPortletMode();
069: }
070:
071: public WindowState getWindowState() {
072: return this .portletRequest.getWindowState();
073: }
074:
075: public PortletPreferences getPreferences() {
076: return this .portletRequest.getPreferences();
077: }
078:
079: public PortletSession getPortletSession() {
080: return this .portletRequest.getPortletSession();
081: }
082:
083: public PortletSession getPortletSession(boolean create) {
084: return this .portletRequest.getPortletSession(create);
085: }
086:
087: public String getProperty(String name) {
088: return this .portletRequest.getProperty(name);
089: }
090:
091: public Enumeration getProperties(String name) {
092: return this .portletRequest.getProperties(name);
093: }
094:
095: public Enumeration getPropertyNames() {
096: return this .portletRequest.getPropertyNames();
097: }
098:
099: public PortalContext getPortalContext() {
100: return this .portletRequest.getPortalContext();
101: }
102:
103: public String getAuthType() {
104: return this .portletRequest.getAuthType();
105: }
106:
107: public String getContextPath() {
108: return this .portletRequest.getContextPath();
109: }
110:
111: public String getRemoteUser() {
112: return this .portletRequest.getRemoteUser();
113: }
114:
115: public Principal getUserPrincipal() {
116: return this .portletRequest.getUserPrincipal();
117: }
118:
119: public boolean isUserInRole(String role) {
120: return this .portletRequest.isUserInRole(role);
121: }
122:
123: public Object getAttribute(String name) {
124: return this .portletRequest.getAttribute(name);
125: }
126:
127: public Enumeration getAttributeNames() {
128: return this .portletRequest.getAttributeNames();
129: }
130:
131: public String getParameter(String name) {
132: return this .portletRequest.getParameter(name);
133: }
134:
135: public Enumeration getParameterNames() {
136: return this .portletRequest.getParameterNames();
137: }
138:
139: public String[] getParameterValues(String name) {
140: return this .portletRequest.getParameterValues(name);
141: }
142:
143: public Map getParameterMap() {
144: return this .portletRequest.getParameterMap();
145: }
146:
147: public boolean isSecure() {
148: return this .portletRequest.isSecure();
149: }
150:
151: public void setAttribute(String name, Object value) {
152: this .portletRequest.setAttribute(name, value);
153: }
154:
155: public void removeAttribute(String name) {
156: this .portletRequest.removeAttribute(name);
157: }
158:
159: public String getRequestedSessionId() {
160: return this .portletRequest.getRequestedSessionId();
161: }
162:
163: public boolean isRequestedSessionIdValid() {
164: return this .portletRequest.isRequestedSessionIdValid();
165: }
166:
167: public String getResponseContentType() {
168: return this .portletRequest.getResponseContentType();
169: }
170:
171: public Enumeration getResponseContentTypes() {
172: return this .portletRequest.getResponseContentTypes();
173: }
174:
175: public Locale getLocale() {
176: return this .portletRequest.getLocale();
177: }
178:
179: public Enumeration getLocales() {
180: return this .portletRequest.getLocales();
181: }
182:
183: public String getScheme() {
184: return this .portletRequest.getScheme();
185: }
186:
187: public String getServerName() {
188: return this .portletRequest.getServerName();
189: }
190:
191: public int getServerPort() {
192: return this.portletRequest.getServerPort();
193: }
194:
195: }
|