| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 /** | 341 /** |
| 350 * Returns the output stream for the request. This is used to write | 342 * Returns the output stream for the request. This is used to write |
| 351 * the request data. When all request data has been written close | 343 * the request data. When all request data has been written close |
| 352 * the stream to indicate the end of the request. | 344 * the stream to indicate the end of the request. |
| 353 * | 345 * |
| 354 * When this is accessed for the first time the request header is | 346 * When this is accessed for the first time the request header is |
| 355 * send. Calling any methods that will change the header after | 347 * send. Calling any methods that will change the header after |
| 356 * having retrieved the output stream will throw an exception. | 348 * having retrieved the output stream will throw an exception. |
| 357 */ | 349 */ |
| 358 OutputStream get outputStream(); | 350 OutputStream get outputStream(); |
| 359 | |
| 360 /** | |
| 361 * Write string data to the request. The string characters will be | |
| 362 * encoded using UFT-8. This is a temporary convenience method as | |
| 363 * long as the OutputStream interface does not have a writeString | |
| 364 * method. | |
| 365 */ | |
| 366 bool writeString(String string); | |
| 367 } | 351 } |
| 368 | 352 |
| 369 | 353 |
| 370 /** | 354 /** |
| 371 * HTTP response for a client connection. | 355 * HTTP response for a client connection. |
| 372 */ | 356 */ |
| 373 interface HttpClientResponse default _HttpClientResponse { | 357 interface HttpClientResponse default _HttpClientResponse { |
| 374 /** | 358 /** |
| 375 * Returns the status code. | 359 * Returns the status code. |
| 376 */ | 360 */ |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 */ | 395 */ |
| 412 InputStream get inputStream(); | 396 InputStream get inputStream(); |
| 413 } | 397 } |
| 414 | 398 |
| 415 | 399 |
| 416 class HttpException implements Exception { | 400 class HttpException implements Exception { |
| 417 const HttpException([String this.message = ""]); | 401 const HttpException([String this.message = ""]); |
| 418 String toString() => "HttpException: $message"; | 402 String toString() => "HttpException: $message"; |
| 419 final String message; | 403 final String message; |
| 420 } | 404 } |
| OLD | NEW |