001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/portal/tags/sakai_2-4-1/portal-service-impl/impl/src/java/org/sakaiproject/portal/service/RecoveredServletRequest.java $
003: * $Id: RecoveredServletRequest.java 29143 2007-04-19 01:10:38Z ajpoland@iupui.edu $
004: ***********************************************************************************
005: *
006: * Copyright (c) 2006 The Sakai Foundation.
007: *
008: * Licensed under the Educational Community License, Version 1.0 (the "License");
009: * you may not use this file except in compliance with the License.
010: * You may obtain a copy of the License at
011: *
012: * http://www.opensource.org/licenses/ecl1.php
013: *
014: * Unless required by applicable law or agreed to in writing, software
015: * distributed under the License is distributed on an "AS IS" BASIS,
016: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: * See the License for the specific language governing permissions and
018: * limitations under the License.
019: *
020: **********************************************************************************/package org.sakaiproject.portal.service;
021:
022: import java.io.BufferedReader;
023: import java.io.IOException;
024: import java.io.UnsupportedEncodingException;
025: import java.security.Principal;
026: import java.util.Enumeration;
027: import java.util.Iterator;
028: import java.util.Locale;
029: import java.util.Map;
030:
031: import javax.servlet.RequestDispatcher;
032: import javax.servlet.ServletInputStream;
033: import javax.servlet.http.Cookie;
034: import javax.servlet.http.HttpServletRequest;
035: import javax.servlet.http.HttpServletRequestWrapper;
036: import javax.servlet.http.HttpSession;
037:
038: /**
039: * @author ieb
040: * @since Sakai 2.4
041: * @version $Rev: 29143 $
042: */
043:
044: public class RecoveredServletRequest extends HttpServletRequestWrapper {
045:
046: private SessionRequestHolder holder = null;
047:
048: public RecoveredServletRequest(HttpServletRequest request,
049: SessionRequestHolder requestHolder) {
050: super (request);
051: this .holder = requestHolder;
052: }
053:
054: @Override
055: public String getAuthType() {
056: return super .getAuthType();
057: }
058:
059: @Override
060: public String getContextPath() {
061: return super .getContextPath();
062: }
063:
064: @Override
065: public Cookie[] getCookies() {
066: return super .getCookies();
067: }
068:
069: @Override
070: public long getDateHeader(String arg0) {
071: return super .getDateHeader(arg0);
072: }
073:
074: @Override
075: public String getHeader(String arg0) {
076: return super .getHeader(arg0);
077: }
078:
079: @Override
080: public Enumeration getHeaderNames() {
081: return super .getHeaderNames();
082: }
083:
084: @Override
085: public Enumeration getHeaders(String arg0) {
086: return super .getHeaders(arg0);
087: }
088:
089: @Override
090: public int getIntHeader(String arg0) {
091: return super .getIntHeader(arg0);
092: }
093:
094: @Override
095: public String getMethod() {
096: return holder.getMethod();
097: }
098:
099: @Override
100: public String getPathInfo() {
101: return super .getPathInfo();
102: }
103:
104: @Override
105: public String getPathTranslated() {
106: return super .getPathTranslated();
107: }
108:
109: @Override
110: public String getQueryString() {
111: return holder.getQueryString();
112: }
113:
114: @Override
115: public String getRemoteUser() {
116: return super .getRemoteUser();
117: }
118:
119: @Override
120: public String getRequestedSessionId() {
121: return super .getRequestedSessionId();
122: }
123:
124: @Override
125: public String getRequestURI() {
126: return super .getRequestURI();
127: }
128:
129: @Override
130: public StringBuffer getRequestURL() {
131: return super .getRequestURL();
132: }
133:
134: @Override
135: public String getServletPath() {
136: return super .getServletPath();
137: }
138:
139: @Override
140: public HttpSession getSession() {
141: return super .getSession();
142: }
143:
144: @Override
145: public HttpSession getSession(boolean arg0) {
146: return super .getSession(arg0);
147: }
148:
149: @Override
150: public Principal getUserPrincipal() {
151: return super .getUserPrincipal();
152: }
153:
154: @Override
155: public boolean isRequestedSessionIdFromCookie() {
156: return super .isRequestedSessionIdFromCookie();
157: }
158:
159: @Override
160: public boolean isRequestedSessionIdFromUrl() {
161: return super .isRequestedSessionIdFromUrl();
162: }
163:
164: @Override
165: public boolean isRequestedSessionIdFromURL() {
166: return super .isRequestedSessionIdFromURL();
167: }
168:
169: @Override
170: public boolean isRequestedSessionIdValid() {
171: return super .isRequestedSessionIdValid();
172: }
173:
174: @Override
175: public boolean isUserInRole(String arg0) {
176: return super .isUserInRole(arg0);
177: }
178:
179: @Override
180: public Object getAttribute(String arg0) {
181: return super .getAttribute(arg0);
182: }
183:
184: @Override
185: public Enumeration getAttributeNames() {
186: return super .getAttributeNames();
187: }
188:
189: @Override
190: public String getCharacterEncoding() {
191: return super .getCharacterEncoding();
192: }
193:
194: @Override
195: public int getContentLength() {
196: return super .getContentLength();
197: }
198:
199: @Override
200: public String getContentType() {
201: return super .getContentType();
202: }
203:
204: @Override
205: public ServletInputStream getInputStream() throws IOException {
206: return super .getInputStream();
207: }
208:
209: @Override
210: public String getLocalAddr() {
211: return super .getLocalAddr();
212: }
213:
214: @Override
215: public Locale getLocale() {
216: return super .getLocale();
217: }
218:
219: @Override
220: public Enumeration getLocales() {
221: return super .getLocales();
222: }
223:
224: @Override
225: public String getLocalName() {
226: return super .getLocalName();
227: }
228:
229: @Override
230: public int getLocalPort() {
231: return super .getLocalPort();
232: }
233:
234: @Override
235: public String getParameter(String arg0) {
236: String value = holder.getParameter(arg0);
237: return value;
238: }
239:
240: @Override
241: public Map getParameterMap() {
242: Map m = holder.getParameterMap();
243: for (Iterator i = m.keySet().iterator(); i.hasNext();) {
244: Object key = i.next();
245: }
246: return m;
247:
248: }
249:
250: @Override
251: public Enumeration getParameterNames() {
252: return holder.getParameterNames();
253: }
254:
255: @Override
256: public String[] getParameterValues(String arg0) {
257: String[] values = holder.getParameterValues(arg0);
258: return values;
259: }
260:
261: private String valueOf(Object o) {
262: if (o instanceof String[]) {
263: String[] values = (String[]) o;
264: StringBuilder sb = new StringBuilder();
265: sb.append("{");
266: for (int i = 0; i < values.length; i++) {
267: if (i != 0) {
268: sb.append(",");
269: }
270: sb.append(values[i]);
271: }
272: sb.append("}");
273: return sb.toString();
274: } else if (o instanceof String) {
275: return (String) o;
276: } else if (o != null) {
277: return o.toString();
278: } else {
279: return null;
280: }
281: }
282:
283: @Override
284: public String getProtocol() {
285: return super .getProtocol();
286: }
287:
288: @Override
289: public BufferedReader getReader() throws IOException {
290: return super .getReader();
291: }
292:
293: @Override
294: public String getRealPath(String arg0) {
295: return super .getRealPath(arg0);
296: }
297:
298: @Override
299: public String getRemoteAddr() {
300: return super .getRemoteAddr();
301: }
302:
303: @Override
304: public String getRemoteHost() {
305: return super .getRemoteHost();
306: }
307:
308: @Override
309: public int getRemotePort() {
310: return super .getRemotePort();
311: }
312:
313: @Override
314: public RequestDispatcher getRequestDispatcher(String arg0) {
315: RequestDispatcher dispatcher = super .getRequestDispatcher(arg0);
316: return dispatcher;
317: }
318:
319: @Override
320: public String getScheme() {
321: return super .getScheme();
322: }
323:
324: @Override
325: public String getServerName() {
326: return super .getServerName();
327: }
328:
329: @Override
330: public int getServerPort() {
331: return super .getServerPort();
332: }
333:
334: @Override
335: public boolean isSecure() {
336: return super .isSecure();
337: }
338:
339: @Override
340: public void removeAttribute(String arg0) {
341: super .removeAttribute(arg0);
342: }
343:
344: @Override
345: public void setAttribute(String arg0, Object arg1) {
346: super .setAttribute(arg0, arg1);
347: }
348:
349: @Override
350: public void setCharacterEncoding(String arg0)
351: throws UnsupportedEncodingException {
352: super.setCharacterEncoding(arg0);
353: }
354: }
|