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