001: /*
002: * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Response.java,v 1.7 2002/03/15 19:12:48 remm Exp $
003: * $Revision: 1.7 $
004: * $Date: 2002/03/15 19:12:48 $
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.IOException;
067: import java.io.OutputStream;
068: import java.io.PrintWriter;
069: import javax.servlet.ServletException;
070: import javax.servlet.ServletOutputStream;
071: import javax.servlet.ServletResponse;
072:
073: /**
074: * A <b>Response</b> is the Catalina-internal facade for a
075: * <code>ServletResponse</code> that is to be produced,
076: * based on the processing of a corresponding <code>Request</code>.
077: *
078: * @author Craig R. McClanahan
079: * @version $Revision: 1.7 $ $Date: 2002/03/15 19:12:48 $
080: */
081:
082: public interface Response {
083:
084: // ------------------------------------------------------------- Properties
085:
086: /**
087: * Return the Connector through which this Response is returned.
088: */
089: public Connector getConnector();
090:
091: /**
092: * Set the Connector through which this Response is returned.
093: *
094: * @param connector The new connector
095: */
096: public void setConnector(Connector connector);
097:
098: /**
099: * Return the number of bytes actually written to the output stream.
100: */
101: public int getContentCount();
102:
103: /**
104: * Return the Context with which this Response is associated.
105: */
106: public Context getContext();
107:
108: /**
109: * Set the Context with which this Response is associated. This should
110: * be called as soon as the appropriate Context is identified.
111: *
112: * @param context The associated Context
113: */
114: public void setContext(Context context);
115:
116: /**
117: * Set the application commit flag.
118: *
119: * @param appCommitted The new application committed flag value
120: */
121: public void setAppCommitted(boolean appCommitted);
122:
123: /**
124: * Application commit flag accessor.
125: */
126: public boolean isAppCommitted();
127:
128: /**
129: * Return the "processing inside an include" flag.
130: */
131: public boolean getIncluded();
132:
133: /**
134: * Set the "processing inside an include" flag.
135: *
136: * @param included <code>true</code> if we are currently inside a
137: * RequestDispatcher.include(), else <code>false</code>
138: */
139: public void setIncluded(boolean included);
140:
141: /**
142: * Return descriptive information about this Response implementation and
143: * the corresponding version number, in the format
144: * <code><description>/<version></code>.
145: */
146: public String getInfo();
147:
148: /**
149: * Return the Request with which this Response is associated.
150: */
151: public Request getRequest();
152:
153: /**
154: * Set the Request with which this Response is associated.
155: *
156: * @param request The new associated request
157: */
158: public void setRequest(Request request);
159:
160: /**
161: * Return the <code>ServletResponse</code> for which this object
162: * is the facade.
163: */
164: public ServletResponse getResponse();
165:
166: /**
167: * Return the output stream associated with this Response.
168: */
169: public OutputStream getStream();
170:
171: /**
172: * Set the output stream associated with this Response.
173: *
174: * @param stream The new output stream
175: */
176: public void setStream(OutputStream stream);
177:
178: /**
179: * Set the suspended flag.
180: *
181: * @param suspended The new suspended flag value
182: */
183: public void setSuspended(boolean suspended);
184:
185: /**
186: * Suspended flag accessor.
187: */
188: public boolean isSuspended();
189:
190: /**
191: * Set the error flag.
192: */
193: public void setError();
194:
195: /**
196: * Error flag accessor.
197: */
198: public boolean isError();
199:
200: // --------------------------------------------------------- Public Methods
201:
202: /**
203: * Create and return a ServletOutputStream to write the content
204: * associated with this Response.
205: *
206: * @exception IOException if an input/output error occurs
207: */
208: public ServletOutputStream createOutputStream() throws IOException;
209:
210: /**
211: * Perform whatever actions are required to flush and close the output
212: * stream or writer, in a single operation.
213: *
214: * @exception IOException if an input/output error occurs
215: */
216: public void finishResponse() throws IOException;
217:
218: /**
219: * Return the content length that was set or calculated for this Response.
220: */
221: public int getContentLength();
222:
223: /**
224: * Return the content type that was set or calculated for this response,
225: * or <code>null</code> if no content type was set.
226: */
227: public String getContentType();
228:
229: /**
230: * Return a PrintWriter that can be used to render error messages,
231: * regardless of whether a stream or writer has already been acquired.
232: *
233: * @return Writer which can be used for error reports. If the response is
234: * not an error report returned using sendError or triggered by an
235: * unexpected exception thrown during the servlet processing
236: * (and only in that case), null will be returned if the response stream
237: * has already been used.
238: */
239: public PrintWriter getReporter();
240:
241: /**
242: * Release all object references, and initialize instance variables, in
243: * preparation for reuse of this object.
244: */
245: public void recycle();
246:
247: /**
248: * Reset the data buffer but not any status or header information.
249: */
250: public void resetBuffer();
251:
252: /**
253: * Send an acknowledgment of a request.
254: *
255: * @exception IOException if an input/output error occurs
256: */
257: public void sendAcknowledgement() throws IOException;
258:
259: }
|