| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | |
| 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. | |
| 4 | |
| 5 class Fling { | |
| 6 static void goForth() native; | |
| 7 static void refresh() native; | |
| 8 static String getInstallPath() native; | |
| 9 } | |
| 10 | |
| 11 | |
| 12 typedef void HttpRequestHandler(HttpRequest req, HttpResponse res); | |
| 13 | |
| 14 | |
| 15 class HttpResponse { | |
| 16 HttpResponse._internal() {} | |
| 17 void finish() native; | |
| 18 void flush() native; | |
| 19 void setHeader(String name, String value) native; | |
| 20 void setStatusCode(int code) native; | |
| 21 void write(String data) native; | |
| 22 static HttpResponse _create() native { | |
| 23 return new HttpResponse._internal(); | |
| 24 } | |
| 25 } | |
| 26 | |
| 27 | |
| 28 class HttpRequest { | |
| 29 HttpRequest._internal() {} | |
| 30 static HttpRequest _create() native { | |
| 31 return new HttpRequest._internal(); | |
| 32 } | |
| 33 String get body() native; | |
| 34 bool get isKeepAlive() native; | |
| 35 String get method() native; | |
| 36 String get requestedPath() native; | |
| 37 String get version() native; | |
| 38 String get prefix() native; | |
| 39 } | |
| 40 | |
| 41 | |
| 42 class HttpServer { | |
| 43 HttpServer() { | |
| 44 _init(); | |
| 45 } | |
| 46 void handle(String path, HttpRequestHandler handler) native; | |
| 47 void listen(int port) native; | |
| 48 void _init() native; | |
| 49 } | |
| 50 | |
| 51 | |
| 52 class ClientApp { | |
| 53 ClientApp(String path, [List<String> staticApps = null]) { | |
| 54 _init(path, staticApps); | |
| 55 } | |
| 56 | |
| 57 static HttpRequestHandler create(String path, [List<String> staticApps = null]
) { | |
| 58 return new ClientApp(path, staticApps).handler; | |
| 59 } | |
| 60 | |
| 61 HttpRequestHandler get handler() { | |
| 62 return ((HttpRequest req, HttpResponse res) { return _handle(req, res); }); | |
| 63 } | |
| 64 | |
| 65 void _handle(HttpRequest req, HttpResponse res) native; | |
| 66 void _init(String path, List<String> staticApps) native; | |
| 67 } | |
| OLD | NEW |