001: /*
002: * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Request.java,v 1.5 2001/08/01 03:04:04 craigmcc Exp $
003: * $Revision: 1.5 $
004: * $Date: 2001/08/01 03:04:04 $
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;
065:
066: import java.io.InputStream;
067: import java.io.IOException;
068: import java.net.Socket;
069: import java.util.Iterator;
070: import javax.servlet.ServletException;
071: import javax.servlet.ServletInputStream;
072: import javax.servlet.ServletRequest;
073:
074: /**
075: * A <b>Request</b> is the Catalina-internal facade for a
076: * <code>ServletRequest</code> that is to be processed, in order to
077: * produce the corresponding <code>Response</code>.
078: *
079: * @author Craig R. McClanahan
080: * @version $Revision: 1.5 $ $Date: 2001/08/01 03:04:04 $
081: */
082:
083: public interface Request {
084:
085: // ------------------------------------------------------------- Properties
086:
087: /**
088: * Return the authorization credentials sent with this request.
089: */
090: public String getAuthorization();
091:
092: /**
093: * Set the authorization credentials sent with this request.
094: *
095: * @param authorization The new authorization credentials
096: */
097: public void setAuthorization(String authorization);
098:
099: /**
100: * Return the Connector through which this Request was received.
101: */
102: public Connector getConnector();
103:
104: /**
105: * Set the Connector through which this Request was received.
106: *
107: * @param connector The new connector
108: */
109: public void setConnector(Connector connector);
110:
111: /**
112: * Return the Context within which this Request is being processed.
113: */
114: public Context getContext();
115:
116: /**
117: * Set the Context within which this Request is being processed. This
118: * must be called as soon as the appropriate Context is identified, because
119: * it identifies the value to be returned by <code>getContextPath()</code>,
120: * and thus enables parsing of the request URI.
121: *
122: * @param context The newly associated Context
123: */
124: public void setContext(Context context);
125:
126: /**
127: * Return descriptive information about this Request implementation and
128: * the corresponding version number, in the format
129: * <code><description>/<version></code>.
130: */
131: public String getInfo();
132:
133: /**
134: * Return the <code>ServletRequest</code> for which this object
135: * is the facade.
136: */
137: public ServletRequest getRequest();
138:
139: /**
140: * Return the Response with which this Request is associated.
141: */
142: public Response getResponse();
143:
144: /**
145: * Set the Response with which this Request is associated.
146: *
147: * @param response The new associated response
148: */
149: public void setResponse(Response response);
150:
151: /**
152: * Return the Socket (if any) through which this Request was received.
153: * This should <strong>only</strong> be used to access underlying state
154: * information about this Socket, such as the SSLSession associated with
155: * an SSLSocket.
156: */
157: public Socket getSocket();
158:
159: /**
160: * Set the Socket (if any) through which this Request was received.
161: *
162: * @param socket The socket through which this request was received
163: */
164: public void setSocket(Socket socket);
165:
166: /**
167: * Return the input stream associated with this Request.
168: */
169: public InputStream getStream();
170:
171: /**
172: * Set the input stream associated with this Request.
173: *
174: * @param stream The new input stream
175: */
176: public void setStream(InputStream stream);
177:
178: /**
179: * Return the Wrapper within which this Request is being processed.
180: */
181: public Wrapper getWrapper();
182:
183: /**
184: * Set the Wrapper within which this Request is being processed. This
185: * must be called as soon as the appropriate Wrapper is identified, and
186: * before the Request is ultimately passed to an application servlet.
187: *
188: * @param wrapper The newly associated Wrapper
189: */
190: public void setWrapper(Wrapper wrapper);
191:
192: // --------------------------------------------------------- Public Methods
193:
194: /**
195: * Create and return a ServletInputStream to read the content
196: * associated with this Request.
197: *
198: * @exception IOException if an input/output error occurs
199: */
200: public ServletInputStream createInputStream() throws IOException;
201:
202: /**
203: * Perform whatever actions are required to flush and close the input
204: * stream or reader, in a single operation.
205: *
206: * @exception IOException if an input/output error occurs
207: */
208: public void finishRequest() throws IOException;
209:
210: /**
211: * Return the object bound with the specified name to the internal notes
212: * for this request, or <code>null</code> if no such binding exists.
213: *
214: * @param name Name of the note to be returned
215: */
216: public Object getNote(String name);
217:
218: /**
219: * Return an Iterator containing the String names of all notes bindings
220: * that exist for this request.
221: */
222: public Iterator getNoteNames();
223:
224: /**
225: * Release all object references, and initialize instance variables, in
226: * preparation for reuse of this object.
227: */
228: public void recycle();
229:
230: /**
231: * Remove any object bound to the specified name in the internal notes
232: * for this request.
233: *
234: * @param name Name of the note to be removed
235: */
236: public void removeNote(String name);
237:
238: /**
239: * Set the content length associated with this Request.
240: *
241: * @param length The new content length
242: */
243: public void setContentLength(int length);
244:
245: /**
246: * Set the content type (and optionally the character encoding)
247: * associated with this Request. For example,
248: * <code>text/html; charset=ISO-8859-4</code>.
249: *
250: * @param type The new content type
251: */
252: public void setContentType(String type);
253:
254: /**
255: * Bind an object to a specified name in the internal notes associated
256: * with this request, replacing any existing binding for this name.
257: *
258: * @param name Name to which the object should be bound
259: * @param value Object to be bound to the specified name
260: */
261: public void setNote(String name, Object value);
262:
263: /**
264: * Set the protocol name and version associated with this Request.
265: *
266: * @param protocol Protocol name and version
267: */
268: public void setProtocol(String protocol);
269:
270: /**
271: * Set the remote IP address associated with this Request. NOTE: This
272: * value will be used to resolve the value for <code>getRemoteHost()</code>
273: * if that method is called.
274: *
275: * @param remote The remote IP address
276: */
277: public void setRemoteAddr(String remote);
278:
279: /**
280: * Set the name of the scheme associated with this request. Typical values
281: * are <code>http</code>, <code>https</code>, and <code>ftp</code>.
282: *
283: * @param scheme The scheme
284: */
285: public void setScheme(String scheme);
286:
287: /**
288: * Set the value to be returned by <code>isSecure()</code>
289: * for this Request.
290: *
291: * @param secure The new isSecure value
292: */
293: public void setSecure(boolean secure);
294:
295: /**
296: * Set the name of the server (virtual host) to process this request.
297: *
298: * @param name The server name
299: */
300: public void setServerName(String name);
301:
302: /**
303: * Set the port number of the server to process this request.
304: *
305: * @param port The server port
306: */
307: public void setServerPort(int port);
308:
309: }
|