001: /*
002: * Copyright 1999-2004 The Apache Software Foundation
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.apache.coyote.tomcat4;
018:
019: import java.io.BufferedReader;
020: import java.io.IOException;
021: import java.util.Enumeration;
022: import java.util.Locale;
023: import java.util.Map;
024:
025: import javax.servlet.RequestDispatcher;
026: import javax.servlet.ServletInputStream;
027: import javax.servlet.http.Cookie;
028: import javax.servlet.http.HttpServletRequest;
029: import javax.servlet.http.HttpSession;
030:
031: import org.apache.catalina.connector.RequestFacade;
032:
033: /**
034: * Facade class that wraps a Coyote request object.
035: * All methods are delegated to the wrapped request.
036: *
037: * @author Craig R. McClanahan
038: * @author Remy Maucherat
039: * @version $Revision: 1.4 $ $Date: 2004/02/24 08:54:29 $
040: */
041:
042: public class CoyoteRequestFacade extends RequestFacade implements
043: HttpServletRequest {
044:
045: // ----------------------------------------------------------- Constructors
046:
047: /**
048: * Construct a wrapper for the specified request.
049: *
050: * @param request The request to be wrapped
051: */
052: public CoyoteRequestFacade(CoyoteRequest request) {
053:
054: super (request);
055: this .request = request;
056:
057: }
058:
059: // ----------------------------------------------------- Instance Variables
060:
061: /**
062: * The wrapped request.
063: */
064: protected CoyoteRequest request = null;
065:
066: // --------------------------------------------------------- Public Methods
067:
068: /**
069: * Clear facade.
070: */
071: public void clear() {
072: request = null;
073: }
074:
075: // ------------------------------------------------- ServletRequest Methods
076:
077: public Object getAttribute(String name) {
078: return request.getAttribute(name);
079: }
080:
081: public Enumeration getAttributeNames() {
082: return request.getAttributeNames();
083: }
084:
085: public String getCharacterEncoding() {
086: return request.getCharacterEncoding();
087: }
088:
089: public void setCharacterEncoding(String env)
090: throws java.io.UnsupportedEncodingException {
091: request.setCharacterEncoding(env);
092: }
093:
094: public int getContentLength() {
095: return request.getContentLength();
096: }
097:
098: public String getContentType() {
099: return request.getContentType();
100: }
101:
102: public ServletInputStream getInputStream() throws IOException {
103: return request.getInputStream();
104: }
105:
106: public String getParameter(String name) {
107: return request.getParameter(name);
108: }
109:
110: public Enumeration getParameterNames() {
111: return request.getParameterNames();
112: }
113:
114: public String[] getParameterValues(String name) {
115: return request.getParameterValues(name);
116: }
117:
118: public Map getParameterMap() {
119: return request.getParameterMap();
120: }
121:
122: public String getProtocol() {
123: return request.getProtocol();
124: }
125:
126: public String getScheme() {
127: return request.getScheme();
128: }
129:
130: public String getServerName() {
131: return request.getServerName();
132: }
133:
134: public int getServerPort() {
135: return request.getServerPort();
136: }
137:
138: public BufferedReader getReader() throws IOException {
139: return request.getReader();
140: }
141:
142: public String getRemoteAddr() {
143: return request.getRemoteAddr();
144: }
145:
146: public String getRemoteHost() {
147: return request.getRemoteHost();
148: }
149:
150: public void setAttribute(String name, Object o) {
151: request.setAttribute(name, o);
152: }
153:
154: public void removeAttribute(String name) {
155: request.removeAttribute(name);
156: }
157:
158: public Locale getLocale() {
159: return request.getLocale();
160: }
161:
162: public Enumeration getLocales() {
163: return request.getLocales();
164: }
165:
166: public boolean isSecure() {
167: return request.isSecure();
168: }
169:
170: public RequestDispatcher getRequestDispatcher(String path) {
171: // TODO : Facade !!
172: return request.getRequestDispatcher(path);
173: }
174:
175: public String getRealPath(String path) {
176: return request.getRealPath(path);
177: }
178:
179: public String getAuthType() {
180: return request.getAuthType();
181: }
182:
183: public Cookie[] getCookies() {
184: return request.getCookies();
185: }
186:
187: public long getDateHeader(String name) {
188: return request.getDateHeader(name);
189: }
190:
191: public String getHeader(String name) {
192: return request.getHeader(name);
193: }
194:
195: public Enumeration getHeaders(String name) {
196: return request.getHeaders(name);
197: }
198:
199: public Enumeration getHeaderNames() {
200: return request.getHeaderNames();
201: }
202:
203: public int getIntHeader(String name) {
204: return request.getIntHeader(name);
205: }
206:
207: public String getMethod() {
208: return request.getMethod();
209: }
210:
211: public String getPathInfo() {
212: return request.getPathInfo();
213: }
214:
215: public String getPathTranslated() {
216: return request.getPathTranslated();
217: }
218:
219: public String getContextPath() {
220: return request.getContextPath();
221: }
222:
223: public String getQueryString() {
224: return request.getQueryString();
225: }
226:
227: public String getRemoteUser() {
228: return request.getRemoteUser();
229: }
230:
231: public boolean isUserInRole(String role) {
232: return request.isUserInRole(role);
233: }
234:
235: public java.security.Principal getUserPrincipal() {
236: return request.getUserPrincipal();
237: }
238:
239: public String getRequestedSessionId() {
240: return request.getRequestedSessionId();
241: }
242:
243: public String getRequestURI() {
244: return request.getRequestURI();
245: }
246:
247: public StringBuffer getRequestURL() {
248: return request.getRequestURL();
249: }
250:
251: public String getServletPath() {
252: return request.getServletPath();
253: }
254:
255: public HttpSession getSession(boolean create) {
256: return request.getSession(create);
257: }
258:
259: public HttpSession getSession() {
260: return getSession(true);
261: }
262:
263: public boolean isRequestedSessionIdValid() {
264: return request.isRequestedSessionIdValid();
265: }
266:
267: public boolean isRequestedSessionIdFromCookie() {
268: return request.isRequestedSessionIdFromCookie();
269: }
270:
271: public boolean isRequestedSessionIdFromURL() {
272: return request.isRequestedSessionIdFromURL();
273: }
274:
275: public boolean isRequestedSessionIdFromUrl() {
276: return request.isRequestedSessionIdFromURL();
277: }
278:
279: }
|