001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package org.apache.pluto.wrappers;
018:
019: import java.util.Enumeration;
020:
021: import javax.portlet.PortalContext;
022: import javax.portlet.PortletMode;
023: import javax.portlet.PortletPreferences;
024: import javax.portlet.PortletRequest;
025: import javax.portlet.PortletSession;
026: import javax.portlet.WindowState;
027:
028: public class PortletRequestWrapper extends
029: javax.servlet.http.HttpServletRequestWrapper implements
030: PortletRequest {
031:
032: /**
033: * Creates a ServletRequest adaptor wrapping the given request object.
034: * @throws java.lang.IllegalArgumentException
035: * if the request is null.
036: */
037: public PortletRequestWrapper(PortletRequest portletRequest) {
038: super ((javax.servlet.http.HttpServletRequest) portletRequest);
039:
040: if (portletRequest == null) {
041: throw new IllegalArgumentException("Request cannot be null");
042: }
043: }
044:
045: // javax.portlet.PortletRequest implementation -------------------------------------------------
046: public boolean isWindowStateAllowed(WindowState state) {
047: return this .getPortletRequest().isWindowStateAllowed(state);
048: }
049:
050: public boolean isPortletModeAllowed(PortletMode mode) {
051: return this .getPortletRequest().isPortletModeAllowed(mode);
052: }
053:
054: public PortletMode getPortletMode() {
055: return this .getPortletRequest().getPortletMode();
056: }
057:
058: public WindowState getWindowState() {
059: return this .getPortletRequest().getWindowState();
060: }
061:
062: public PortletPreferences getPreferences() {
063: return this .getPortletRequest().getPreferences();
064: }
065:
066: public PortletSession getPortletSession() {
067: return this .getPortletRequest().getPortletSession();
068: }
069:
070: public PortletSession getPortletSession(boolean create) {
071: return this .getPortletRequest().getPortletSession(create);
072: }
073:
074: public String getProperty(String name) {
075: return this .getPortletRequest().getProperty(name);
076: }
077:
078: public Enumeration getProperties(String name) {
079: return this .getPortletRequest().getProperties(name);
080: }
081:
082: public Enumeration getPropertyNames() {
083: return this .getPortletRequest().getPropertyNames();
084: }
085:
086: public PortalContext getPortalContext() {
087: return this .getPortletRequest().getPortalContext();
088: }
089:
090: public java.lang.String getAuthType() {
091: return this .getPortletRequest().getAuthType();
092: }
093:
094: public String getContextPath() {
095: return this .getPortletRequest().getContextPath();
096: }
097:
098: public java.lang.String getRemoteUser() {
099: return this .getPortletRequest().getRemoteUser();
100: }
101:
102: public java.security.Principal getUserPrincipal() {
103: return this .getPortletRequest().getUserPrincipal();
104: }
105:
106: public boolean isUserInRole(java.lang.String role) {
107: return this .getPortletRequest().isUserInRole(role);
108: }
109:
110: public Object getAttribute(String name) {
111: return this .getPortletRequest().getAttribute(name);
112: }
113:
114: public java.util.Enumeration getAttributeNames() {
115: return this .getPortletRequest().getAttributeNames();
116: }
117:
118: public String getParameter(String name) {
119: return this .getPortletRequest().getParameter(name);
120: }
121:
122: public java.util.Enumeration getParameterNames() {
123: return this .getPortletRequest().getParameterNames();
124: }
125:
126: public String[] getParameterValues(String name) {
127: return this .getPortletRequest().getParameterValues(name);
128: }
129:
130: public java.util.Map getParameterMap() {
131: return this .getPortletRequest().getParameterMap();
132: }
133:
134: public boolean isSecure() {
135: return this .getPortletRequest().isSecure();
136: }
137:
138: public void setAttribute(String name, Object o) {
139: this .getPortletRequest().setAttribute(name, o);
140: }
141:
142: public void removeAttribute(String name) {
143: this .getPortletRequest().removeAttribute(name);
144: }
145:
146: public String getRequestedSessionId() {
147: return this .getPortletRequest().getRequestedSessionId();
148: }
149:
150: public boolean isRequestedSessionIdValid() {
151: return this .getPortletRequest().isRequestedSessionIdValid();
152: }
153:
154: public String getResponseContentType() {
155: return this .getPortletRequest().getResponseContentType();
156: }
157:
158: public java.util.Enumeration getResponseContentTypes() {
159: return this .getPortletRequest().getResponseContentTypes();
160: }
161:
162: public java.util.Locale getLocale() {
163: return this .getPortletRequest().getLocale();
164: }
165:
166: public java.util.Enumeration getLocales() {
167: return this .getPortletRequest().getLocales();
168: }
169:
170: public String getScheme() {
171: return this .getPortletRequest().getScheme();
172: }
173:
174: public String getServerName() {
175: return this .getPortletRequest().getServerName();
176: }
177:
178: public int getServerPort() {
179: return this .getPortletRequest().getServerPort();
180: }
181:
182: // --------------------------------------------------------------------------------------------
183:
184: // additional methods -------------------------------------------------------------------------
185: /**
186: * Return the wrapped ServletRequest object.
187: */
188: public PortletRequest getPortletRequest() {
189: return (PortletRequest) super .getRequest();
190: }
191:
192: /**
193: * Sets the request being wrapped.
194: * @throws java.lang.IllegalArgumentException
195: * if the request is null.
196: */
197: public void setRequest(PortletRequest request) {
198: if (request == null) {
199: throw new IllegalArgumentException("Request cannot be null");
200: }
201: setRequest((javax.servlet.http.HttpServletRequest) request);
202: }
203: // --------------------------------------------------------------------------------------------
204: }
|