Chromium Code Reviews| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 62 * Start listening for HTTP requests on the specified [host] and | 62 * Start listening for HTTP requests on the specified [host] and |
| 63 * [port]. For each HTTP request the handler set through [onRequest] | 63 * [port]. For each HTTP request the handler set through [onRequest] |
| 64 * will be invoked. If a [port] of 0 is specified the server will | 64 * will be invoked. If a [port] of 0 is specified the server will |
| 65 * choose an ephemeral port. The optional argument [backlog] can be | 65 * choose an ephemeral port. The optional argument [backlog] can be |
| 66 * used to specify the listen backlog for the underlying OS listen | 66 * used to specify the listen backlog for the underlying OS listen |
| 67 * setup. | 67 * setup. |
| 68 */ | 68 */ |
| 69 void listen(String host, int port, [int backlog]); | 69 void listen(String host, int port, [int backlog]); |
| 70 | 70 |
| 71 /** | 71 /** |
| 72 * Attach the HTTP server to an existing ServerSocket. If the server is | |
| 73 * closed, the HttpServer will just detach itself, and not close | |
| 74 * [serverSocket]. | |
| 75 */ | |
| 76 void attachTo(ServerSocket serverSocket); | |
|
Søren Gjesse
2012/04/02 07:32:41
How about calling this listenOn?
Anders Johnsen
2012/04/02 07:36:52
Agreed, updated.
| |
| 77 | |
| 78 /** | |
| 72 * Stop server listening. | 79 * Stop server listening. |
| 73 */ | 80 */ |
| 74 void close(); | 81 void close(); |
| 75 | 82 |
| 76 /** | 83 /** |
| 77 * Returns the port that the server is listening on. This can be | 84 * Returns the port that the server is listening on. This can be |
| 78 * used to get the actual port used when a value of 0 for [port] is | 85 * used to get the actual port used when a value of 0 for [port] is |
| 79 * specified in the [listen] call. | 86 * specified in the [listen] call. |
| 80 */ | 87 */ |
| 81 int get port(); | 88 int get port(); |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 395 */ | 402 */ |
| 396 InputStream get inputStream(); | 403 InputStream get inputStream(); |
| 397 } | 404 } |
| 398 | 405 |
| 399 | 406 |
| 400 class HttpException implements Exception { | 407 class HttpException implements Exception { |
| 401 const HttpException([String this.message = ""]); | 408 const HttpException([String this.message = ""]); |
| 402 String toString() => "HttpException: $message"; | 409 String toString() => "HttpException: $message"; |
| 403 final String message; | 410 final String message; |
| 404 } | 411 } |
| OLD | NEW |