001: /*
002: * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/InvokerHttpRequest.java,v 1.5 2002/05/23 07:13:45 remm Exp $
003: * $Revision: 1.5 $
004: * $Date: 2002/05/23 07:13:45 $
005: *
006: * ====================================================================
007: *
008: * The Apache Software License, Version 1.1
009: *
010: * Copyright (c) 1999 The Apache Software Foundation. All rights
011: * reserved.
012: *
013: * Redistribution and use in source and binary forms, with or without
014: * modification, are permitted provided that the following conditions
015: * are met:
016: *
017: * 1. Redistributions of source code must retain the above copyright
018: * notice, this list of conditions and the following disclaimer.
019: *
020: * 2. Redistributions in binary form must reproduce the above copyright
021: * notice, this list of conditions and the following disclaimer in
022: * the documentation and/or other materials provided with the
023: * distribution.
024: *
025: * 3. The end-user documentation included with the redistribution, if
026: * any, must include the following acknowlegement:
027: * "This product includes software developed by the
028: * Apache Software Foundation (http://www.apache.org/)."
029: * Alternately, this acknowlegement may appear in the software itself,
030: * if and wherever such third-party acknowlegements normally appear.
031: *
032: * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
033: * Foundation" must not be used to endorse or promote products derived
034: * from this software without prior written permission. For written
035: * permission, please contact apache@apache.org.
036: *
037: * 5. Products derived from this software may not be called "Apache"
038: * nor may "Apache" appear in their names without prior written
039: * permission of the Apache Group.
040: *
041: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
042: * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
043: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
044: * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
045: * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
046: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
047: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
048: * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
049: * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
050: * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
051: * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
052: * SUCH DAMAGE.
053: * ====================================================================
054: *
055: * This software consists of voluntary contributions made by many
056: * individuals on behalf of the Apache Software Foundation. For more
057: * information on the Apache Software Foundation, please see
058: * <http://www.apache.org/>.
059: *
060: * [Additional notices, if required by prior licensing conditions]
061: *
062: */
063:
064: package org.apache.catalina.servlets;
065:
066: import java.io.IOException;
067: import java.util.ArrayList;
068: import java.util.Enumeration;
069: import java.util.HashMap;
070: import java.util.Iterator;
071: import java.util.Map;
072: import javax.servlet.http.HttpServletRequest;
073: import javax.servlet.http.HttpServletRequestWrapper;
074: import org.apache.catalina.Globals;
075: import org.apache.catalina.HttpRequest;
076: import org.apache.catalina.util.Enumerator;
077: import org.apache.catalina.util.RequestUtil;
078: import org.apache.catalina.util.StringManager;
079:
080: /**
081: * Wrapper around a <code>javax.servlet.http.HttpServletRequest</code>
082: * utilized when <code>InvokerServlet</code> processes the initial request
083: * for an invoked servlet. Subsequent requests will be mapped directly
084: * to the servlet, because a new servlet mapping will have been created.
085: *
086: * @author Craig R. McClanahan
087: * @version $Revision: 1.5 $ $Date: 2002/05/23 07:13:45 $
088: */
089:
090: class InvokerHttpRequest extends HttpServletRequestWrapper {
091:
092: // ----------------------------------------------------------- Constructors
093:
094: /**
095: * Construct a new wrapped request around the specified servlet request.
096: *
097: * @param request The servlet request being wrapped
098: */
099: public InvokerHttpRequest(HttpServletRequest request) {
100:
101: super (request);
102: this .pathInfo = request.getPathInfo();
103: this .pathTranslated = request.getPathTranslated();
104: this .requestURI = request.getRequestURI();
105: this .servletPath = request.getServletPath();
106:
107: }
108:
109: // ----------------------------------------------------- Instance Variables
110:
111: /**
112: * Descriptive information about this implementation.
113: */
114: protected static final String info = "org.apache.catalina.servlets.InvokerHttpRequest/1.0";
115:
116: /**
117: * The path information for this request.
118: */
119: protected String pathInfo = null;
120:
121: /**
122: * The translated path information for this request.
123: */
124: protected String pathTranslated = null;
125:
126: /**
127: * The request URI for this request.
128: */
129: protected String requestURI = null;
130:
131: /**
132: * The servlet path for this request.
133: */
134: protected String servletPath = null;
135:
136: /**
137: * The string manager for this package.
138: */
139: protected static StringManager sm = StringManager
140: .getManager(Constants.Package);
141:
142: // --------------------------------------------- HttpServletRequest Methods
143:
144: /**
145: * Override the <code>getPathInfo()</code> method of the wrapped request.
146: */
147: public String getPathInfo() {
148:
149: return (this .pathInfo);
150:
151: }
152:
153: /**
154: * Override the <code>getPathTranslated()</code> method of the
155: * wrapped request.
156: */
157: public String getPathTranslated() {
158:
159: return (this .pathTranslated);
160:
161: }
162:
163: /**
164: * Override the <code>getRequestURI()</code> method of the wrapped request.
165: */
166: public String getRequestURI() {
167:
168: return (this .requestURI);
169:
170: }
171:
172: /**
173: * Override the <code>getServletPath()</code> method of the wrapped
174: * request.
175: */
176: public String getServletPath() {
177:
178: return (this .servletPath);
179:
180: }
181:
182: // -------------------------------------------------------- Package Methods
183:
184: /**
185: * Return descriptive information about this implementation.
186: */
187: public String getInfo() {
188:
189: return (this .info);
190:
191: }
192:
193: /**
194: * Set the path information for this request.
195: *
196: * @param pathInfo The new path info
197: */
198: void setPathInfo(String pathInfo) {
199:
200: this .pathInfo = pathInfo;
201:
202: }
203:
204: /**
205: * Set the translated path info for this request.
206: *
207: * @param pathTranslated The new translated path info
208: */
209: void setPathTranslated(String pathTranslated) {
210:
211: this .pathTranslated = pathTranslated;
212:
213: }
214:
215: /**
216: * Set the request URI for this request.
217: *
218: * @param requestURI The new request URI
219: */
220: void setRequestURI(String requestURI) {
221:
222: this .requestURI = requestURI;
223:
224: }
225:
226: /**
227: * Set the servlet path for this request.
228: *
229: * @param servletPath The new servlet path
230: */
231: void setServletPath(String servletPath) {
232:
233: this.servletPath = servletPath;
234:
235: }
236:
237: }
|