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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
227 * Opens a HTTP connection. The returned [HttpClientConnection] is | 227 * Opens a HTTP connection. The returned [HttpClientConnection] is |
228 * used to register callbacks for asynchronous events on the HTTP | 228 * used to register callbacks for asynchronous events on the HTTP |
229 * connection. The "Host" header for the request will be set to the | 229 * connection. The "Host" header for the request will be set to the |
230 * value [host]:[port]. This can be overridden through the | 230 * value [host]:[port]. This can be overridden through the |
231 * HttpClientRequest interface before the request is sent. NOTE if | 231 * HttpClientRequest interface before the request is sent. NOTE if |
232 * [host] is an IP address this will still be set in the "Host" | 232 * [host] is an IP address this will still be set in the "Host" |
233 * header. | 233 * header. |
234 */ | 234 */ |
235 HttpClientConnection open(String method, String host, int port, String path); | 235 HttpClientConnection open(String method, String host, int port, String path); |
236 | 236 |
237 HttpClientConnection openUrl(String method, Uri url); | |
Mads Ager (google)
2012/03/08 08:02:52
Please add doc comment for all three of these.
Søren Gjesse
2012/03/08 08:30:04
Done.
| |
238 | |
237 /** | 239 /** |
238 * Opens a HTTP connection using the GET method. See [open] for details. | 240 * Opens a HTTP connection using the GET method. See [open] for details. |
239 */ | 241 */ |
240 HttpClientConnection get(String host, int port, String path); | 242 HttpClientConnection get(String host, int port, String path); |
241 | 243 |
244 HttpClientConnection getUrl(Uri url); | |
245 | |
242 /** | 246 /** |
243 * Opens a HTTP connection using the POST method. See [open] for details. | 247 * Opens a HTTP connection using the POST method. See [open] for details. |
244 */ | 248 */ |
245 HttpClientConnection post(String host, int port, String path); | 249 HttpClientConnection post(String host, int port, String path); |
246 | 250 |
251 HttpClientConnection postUrl(Uri url); | |
252 | |
247 /** | 253 /** |
248 * Shutdown the HTTP client releasing all resources. | 254 * Shutdown the HTTP client releasing all resources. |
249 */ | 255 */ |
250 void shutdown(); | 256 void shutdown(); |
251 } | 257 } |
252 | 258 |
253 | 259 |
254 /** | 260 /** |
255 * A [HttpClientConnection] is returned by all [HttpClient] methods | 261 * A [HttpClientConnection] is returned by all [HttpClient] methods |
256 * that initiate a connection to an HTTP server. The handlers will be | 262 * that initiate a connection to an HTTP server. The handlers will be |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
390 */ | 396 */ |
391 InputStream get inputStream(); | 397 InputStream get inputStream(); |
392 } | 398 } |
393 | 399 |
394 | 400 |
395 class HttpException implements Exception { | 401 class HttpException implements Exception { |
396 const HttpException([String this.message = ""]); | 402 const HttpException([String this.message = ""]); |
397 String toString() => "HttpException: $message"; | 403 String toString() => "HttpException: $message"; |
398 final String message; | 404 final String message; |
399 } | 405 } |
OLD | NEW |