| 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 /** | 110 /** |
| 111 * Returns the port that the server is listening on. This can be | 111 * Returns the port that the server is listening on. This can be |
| 112 * used to get the actual port used when a value of 0 for [port] is | 112 * used to get the actual port used when a value of 0 for [port] is |
| 113 * specified in the [listen] call. | 113 * specified in the [listen] call. |
| 114 */ | 114 */ |
| 115 int get port(); | 115 int get port(); |
| 116 | 116 |
| 117 /** | 117 /** |
| 118 * Sets the error handler that is called when a connection error occurs. | 118 * Sets the error handler that is called when a connection error occurs. |
| 119 */ | 119 */ |
| 120 void set onError(void callback(Exception e)); | 120 void set onError(void callback(e)); |
| 121 } | 121 } |
| 122 | 122 |
| 123 | 123 |
| 124 /** | 124 /** |
| 125 * Access to the HTTP headers for requests and responses. In some | 125 * Access to the HTTP headers for requests and responses. In some |
| 126 * situations the headers will be imutable and the mutating methods | 126 * situations the headers will be imutable and the mutating methods |
| 127 * will then throw exceptions. | 127 * will then throw exceptions. |
| 128 * | 128 * |
| 129 * For all operation on HTTP headers the header name is | 129 * For all operation on HTTP headers the header name is |
| 130 * case-insensitive. | 130 * case-insensitive. |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 * the response is ready for processing. The callback is called when | 470 * the response is ready for processing. The callback is called when |
| 471 * all headers of the response are received and data is ready to be | 471 * all headers of the response are received and data is ready to be |
| 472 * received. | 472 * received. |
| 473 */ | 473 */ |
| 474 void set onResponse(void callback(HttpClientResponse response)); | 474 void set onResponse(void callback(HttpClientResponse response)); |
| 475 | 475 |
| 476 /** | 476 /** |
| 477 * Sets the handler that gets called if an error occurs while | 477 * Sets the handler that gets called if an error occurs while |
| 478 * connecting or processing the HTTP request. | 478 * connecting or processing the HTTP request. |
| 479 */ | 479 */ |
| 480 void set onError(void callback(Exception e)); | 480 void set onError(void callback(e)); |
| 481 } | 481 } |
| 482 | 482 |
| 483 | 483 |
| 484 /** | 484 /** |
| 485 * HTTP request for a client connection. | 485 * HTTP request for a client connection. |
| 486 */ | 486 */ |
| 487 interface HttpClientRequest default _HttpClientRequest { | 487 interface HttpClientRequest default _HttpClientRequest { |
| 488 /** | 488 /** |
| 489 * Gets and sets the content length of the request. If the size of | 489 * Gets and sets the content length of the request. If the size of |
| 490 * the request is not known in advance set content length to -1, | 490 * the request is not known in advance set content length to -1, |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 */ | 541 */ |
| 542 InputStream get inputStream(); | 542 InputStream get inputStream(); |
| 543 } | 543 } |
| 544 | 544 |
| 545 | 545 |
| 546 class HttpException implements Exception { | 546 class HttpException implements Exception { |
| 547 const HttpException([String this.message = ""]); | 547 const HttpException([String this.message = ""]); |
| 548 String toString() => "HttpException: $message"; | 548 String toString() => "HttpException: $message"; |
| 549 final String message; | 549 final String message; |
| 550 } | 550 } |
| OLD | NEW |