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.catalina.servlets;
018:
019: import javax.servlet.http.HttpServletRequest;
020: import javax.servlet.http.HttpServletRequestWrapper;
021:
022: import org.apache.catalina.util.StringManager;
023:
024: /**
025: * Wrapper around a <code>javax.servlet.http.HttpServletRequest</code>
026: * utilized when <code>InvokerServlet</code> processes the initial request
027: * for an invoked servlet. Subsequent requests will be mapped directly
028: * to the servlet, because a new servlet mapping will have been created.
029: *
030: * @author Craig R. McClanahan
031: * @version $Revision: 1.4 $ $Date: 2004/02/27 14:58:46 $
032: */
033:
034: class InvokerHttpRequest extends HttpServletRequestWrapper {
035:
036: // ----------------------------------------------------------- Constructors
037:
038: /**
039: * Construct a new wrapped request around the specified servlet request.
040: *
041: * @param request The servlet request being wrapped
042: */
043: public InvokerHttpRequest(HttpServletRequest request) {
044:
045: super (request);
046: this .pathInfo = request.getPathInfo();
047: this .pathTranslated = request.getPathTranslated();
048: this .requestURI = request.getRequestURI();
049: this .servletPath = request.getServletPath();
050:
051: }
052:
053: // ----------------------------------------------------- Instance Variables
054:
055: /**
056: * Descriptive information about this implementation.
057: */
058: protected static final String info = "org.apache.catalina.servlets.InvokerHttpRequest/1.0";
059:
060: /**
061: * The path information for this request.
062: */
063: protected String pathInfo = null;
064:
065: /**
066: * The translated path information for this request.
067: */
068: protected String pathTranslated = null;
069:
070: /**
071: * The request URI for this request.
072: */
073: protected String requestURI = null;
074:
075: /**
076: * The servlet path for this request.
077: */
078: protected String servletPath = null;
079:
080: /**
081: * The string manager for this package.
082: */
083: protected static StringManager sm = StringManager
084: .getManager(Constants.Package);
085:
086: // --------------------------------------------- HttpServletRequest Methods
087:
088: /**
089: * Override the <code>getPathInfo()</code> method of the wrapped request.
090: */
091: public String getPathInfo() {
092:
093: return (this .pathInfo);
094:
095: }
096:
097: /**
098: * Override the <code>getPathTranslated()</code> method of the
099: * wrapped request.
100: */
101: public String getPathTranslated() {
102:
103: return (this .pathTranslated);
104:
105: }
106:
107: /**
108: * Override the <code>getRequestURI()</code> method of the wrapped request.
109: */
110: public String getRequestURI() {
111:
112: return (this .requestURI);
113:
114: }
115:
116: /**
117: * Override the <code>getServletPath()</code> method of the wrapped
118: * request.
119: */
120: public String getServletPath() {
121:
122: return (this .servletPath);
123:
124: }
125:
126: // -------------------------------------------------------- Package Methods
127:
128: /**
129: * Return descriptive information about this implementation.
130: */
131: public String getInfo() {
132:
133: return (info);
134:
135: }
136:
137: /**
138: * Set the path information for this request.
139: *
140: * @param pathInfo The new path info
141: */
142: void setPathInfo(String pathInfo) {
143:
144: this .pathInfo = pathInfo;
145:
146: }
147:
148: /**
149: * Set the translated path info for this request.
150: *
151: * @param pathTranslated The new translated path info
152: */
153: void setPathTranslated(String pathTranslated) {
154:
155: this .pathTranslated = pathTranslated;
156:
157: }
158:
159: /**
160: * Set the request URI for this request.
161: *
162: * @param requestURI The new request URI
163: */
164: void setRequestURI(String requestURI) {
165:
166: this .requestURI = requestURI;
167:
168: }
169:
170: /**
171: * Set the servlet path for this request.
172: *
173: * @param servletPath The new servlet path
174: */
175: void setServletPath(String servletPath) {
176:
177: this.servletPath = servletPath;
178:
179: }
180:
181: }
|