OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * HTTP status codes. | 6 * HTTP status codes. |
7 */ | 7 */ |
8 interface HttpStatus { | 8 interface HttpStatus { |
9 static final int CONTINUE = 100; | 9 static final int CONTINUE = 100; |
10 static final int SWITCHING_PROTOCOLS = 101; | 10 static final int SWITCHING_PROTOCOLS = 101; |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 /** | 197 /** |
198 * Returns the output stream for the response. This is used to write | 198 * Returns the output stream for the response. This is used to write |
199 * the response data. When all response data has been written close | 199 * the response data. When all response data has been written close |
200 * the stream to indicate the end of the response. | 200 * the stream to indicate the end of the response. |
201 * | 201 * |
202 * When this is accessed for the first time the response header is | 202 * When this is accessed for the first time the response header is |
203 * send. Calling any methods that will change the header after | 203 * send. Calling any methods that will change the header after |
204 * having retrieved the output stream will throw an exception. | 204 * having retrieved the output stream will throw an exception. |
205 */ | 205 */ |
206 OutputStream get outputStream(); | 206 OutputStream get outputStream(); |
207 | |
208 /** | |
209 * Write string data to the response. The string characters will be | |
210 * encoded using UFT-8. This is a temporary convenience method as | |
211 * long as the OutputStream interface does not have a writeString | |
212 * method. | |
213 */ | |
214 bool writeString(String string); | |
215 } | 207 } |
216 | 208 |
217 | 209 |
218 /** | 210 /** |
219 * HTTP client factory. | 211 * HTTP client factory. |
220 */ | 212 */ |
221 interface HttpClient default _HttpClient { | 213 interface HttpClient default _HttpClient { |
222 static final int DEFAULT_HTTP_PORT = 80; | 214 static final int DEFAULT_HTTP_PORT = 80; |
223 | 215 |
224 HttpClient(); | 216 HttpClient(); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 /** | 320 /** |
329 * Returns the output stream for the request. This is used to write | 321 * Returns the output stream for the request. This is used to write |
330 * the request data. When all request data has been written close | 322 * the request data. When all request data has been written close |
331 * the stream to indicate the end of the request. | 323 * the stream to indicate the end of the request. |
332 * | 324 * |
333 * When this is accessed for the first time the request header is | 325 * When this is accessed for the first time the request header is |
334 * send. Calling any methods that will change the header after | 326 * send. Calling any methods that will change the header after |
335 * having retrieved the output stream will throw an exception. | 327 * having retrieved the output stream will throw an exception. |
336 */ | 328 */ |
337 OutputStream get outputStream(); | 329 OutputStream get outputStream(); |
338 | |
339 /** | |
340 * Write string data to the request. The string characters will be | |
341 * encoded using UFT-8. This is a temporary convenience method as | |
342 * long as the OutputStream interface does not have a writeString | |
343 * method. | |
344 */ | |
345 bool writeString(String string); | |
346 } | 330 } |
347 | 331 |
348 | 332 |
349 /** | 333 /** |
350 * HTTP response for a client connection. | 334 * HTTP response for a client connection. |
351 */ | 335 */ |
352 interface HttpClientResponse default _HttpClientResponse { | 336 interface HttpClientResponse default _HttpClientResponse { |
353 /** | 337 /** |
354 * Returns the status code. | 338 * Returns the status code. |
355 */ | 339 */ |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 */ | 374 */ |
391 InputStream get inputStream(); | 375 InputStream get inputStream(); |
392 } | 376 } |
393 | 377 |
394 | 378 |
395 class HttpException implements Exception { | 379 class HttpException implements Exception { |
396 const HttpException([String this.message = ""]); | 380 const HttpException([String this.message = ""]); |
397 String toString() => "HttpException: $message"; | 381 String toString() => "HttpException: $message"; |
398 final String message; | 382 final String message; |
399 } | 383 } |
OLD | NEW |