KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > catalina > Response


1
2
3 /*
4  * The contents of this file are subject to the terms
5  * of the Common Development and Distribution License
6  * (the "License"). You may not use this file except
7  * in compliance with the License.
8  *
9  * You can obtain a copy of the license at
10  * glassfish/bootstrap/legal/CDDLv1.0.txt or
11  * https://glassfish.dev.java.net/public/CDDLv1.0.html.
12  * See the License for the specific language governing
13  * permissions and limitations under the License.
14  *
15  * When distributing Covered Code, include this CDDL
16  * HEADER in each file and include the License file at
17  * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
18  * add the following below this CDDL HEADER, with the
19  * fields enclosed by brackets "[]" replaced with your
20  * own identifying information: Portions Copyright [yyyy]
21  * [name of copyright owner]
22  *
23  * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24  *
25  * Portions Copyright Apache Software Foundation.
26  */

27
28
29 package org.apache.catalina;
30
31
32 import java.io.IOException JavaDoc;
33 import java.io.OutputStream JavaDoc;
34 import java.io.PrintWriter JavaDoc;
35 import javax.servlet.ServletException JavaDoc;
36 import javax.servlet.ServletOutputStream JavaDoc;
37 import javax.servlet.ServletResponse JavaDoc;
38
39
40 /**
41  * A <b>Response</b> is the Catalina-internal facade for a
42  * <code>ServletResponse</code> that is to be produced,
43  * based on the processing of a corresponding <code>Request</code>.
44  *
45  * @author Craig R. McClanahan
46  * @version $Revision: 1.2 $ $Date: 2005/12/08 01:27:19 $
47  */

48
49 public interface Response {
50
51
52     // ------------------------------------------------------------- Properties
53

54
55     /**
56      * Return the Connector through which this Response is returned.
57      */

58     public Connector getConnector();
59
60
61     /**
62      * Set the Connector through which this Response is returned.
63      *
64      * @param connector The new connector
65      */

66     public void setConnector(Connector connector);
67
68
69     /**
70      * Return the number of bytes actually written to the output stream.
71      */

72     public int getContentCount();
73
74
75     /**
76      * Return the Context with which this Response is associated.
77      */

78     public Context getContext();
79
80
81     /**
82      * Set the Context with which this Response is associated. This should
83      * be called as soon as the appropriate Context is identified.
84      *
85      * @param context The associated Context
86      */

87     public void setContext(Context context);
88
89
90     /**
91      * Set the application commit flag.
92      *
93      * @param appCommitted The new application committed flag value
94      */

95     public void setAppCommitted(boolean appCommitted);
96
97
98     /**
99      * Application commit flag accessor.
100      */

101     public boolean isAppCommitted();
102
103
104     /**
105      * Return the "processing inside an include" flag.
106      */

107     public boolean getIncluded();
108
109
110     /**
111      * Set the "processing inside an include" flag.
112      *
113      * @param included <code>true</code> if we are currently inside a
114      * RequestDispatcher.include(), else <code>false</code>
115      */

116     public void setIncluded(boolean included);
117
118
119     /**
120      * Return descriptive information about this Response implementation and
121      * the corresponding version number, in the format
122      * <code>&lt;description&gt;/&lt;version&gt;</code>.
123      */

124     public String JavaDoc getInfo();
125
126
127     /**
128      * Return the Request with which this Response is associated.
129      */

130     public Request getRequest();
131
132
133     /**
134      * Set the Request with which this Response is associated.
135      *
136      * @param request The new associated request
137      */

138     public void setRequest(Request request);
139
140
141     /**
142      * Return the <code>ServletResponse</code> for which this object
143      * is the facade.
144      */

145     public ServletResponse JavaDoc getResponse();
146
147
148     /**
149      * Return the output stream associated with this Response.
150      */

151     public OutputStream JavaDoc getStream();
152
153
154     /**
155      * Set the output stream associated with this Response.
156      *
157      * @param stream The new output stream
158      */

159     public void setStream(OutputStream JavaDoc stream);
160
161
162     /**
163      * Set the suspended flag.
164      *
165      * @param suspended The new suspended flag value
166      */

167     public void setSuspended(boolean suspended);
168
169
170     /**
171      * Suspended flag accessor.
172      */

173     public boolean isSuspended();
174
175
176     /**
177      * Set the error flag.
178      */

179     public void setError();
180
181
182     /**
183      * Error flag accessor.
184      */

185     public boolean isError();
186
187
188     // BEGIN S1AS 4878272
189
/**
190      * Sets detail error message.
191      *
192      * @param message detail error message
193      */

194     public void setDetailMessage(String JavaDoc message);
195
196
197     /**
198      * Gets detail error message.
199      *
200      * @return the detail error message
201      */

202     public String JavaDoc getDetailMessage();
203     // END S1AS 4878272
204

205
206     // --------------------------------------------------------- Public Methods
207

208
209     /**
210      * Create and return a ServletOutputStream to write the content
211      * associated with this Response.
212      *
213      * @exception IOException if an input/output error occurs
214      */

215     public ServletOutputStream JavaDoc createOutputStream() throws IOException JavaDoc;
216
217
218     /**
219      * Perform whatever actions are required to flush and close the output
220      * stream or writer, in a single operation.
221      *
222      * @exception IOException if an input/output error occurs
223      */

224     public void finishResponse() throws IOException JavaDoc;
225
226
227     /**
228      * Return the content length that was set or calculated for this Response.
229      */

230     public int getContentLength();
231
232
233     /**
234      * Return the content type that was set or calculated for this response,
235      * or <code>null</code> if no content type was set.
236      */

237     public String JavaDoc getContentType();
238
239
240     /**
241      * Return a PrintWriter that can be used to render error messages,
242      * regardless of whether a stream or writer has already been acquired.
243      *
244      * @return Writer which can be used for error reports. If the response is
245      * not an error report returned using sendError or triggered by an
246      * unexpected exception thrown during the servlet processing
247      * (and only in that case), null will be returned if the response stream
248      * has already been used.
249      *
250      * @exception IOException if an input/output error occurs
251      */

252     public PrintWriter JavaDoc getReporter() throws IOException JavaDoc;
253
254
255     /**
256      * Release all object references, and initialize instance variables, in
257      * preparation for reuse of this object.
258      */

259     public void recycle();
260
261
262     /**
263      * Reset the data buffer but not any status or header information.
264      */

265     public void resetBuffer();
266
267
268     /**
269      * Send an acknowledgment of a request.
270      *
271      * @exception IOException if an input/output error occurs
272      */

273     public void sendAcknowledgement()
274         throws IOException JavaDoc;
275
276
277 }
278
Popular Tags