| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library http.server; | 5 library http.server; |
| 6 | 6 |
| 7 import 'dart:io'; | 7 import 'dart:io'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/channel.dart'; | 9 import 'package:analysis_server/src/channel.dart'; |
| 10 import 'package:analysis_server/src/get_handler.dart'; | 10 import 'package:analysis_server/src/get_handler.dart'; |
| 11 import 'package:analysis_server/src/socket_server.dart'; | 11 import 'package:analysis_server/src/socket_server.dart'; |
| 12 | 12 |
| 13 /** | 13 /** |
| 14 * Instances of the class [HttpServer] implement a simple HTTP server. The | 14 * Instances of the class [HttpServer] implement a simple HTTP server. The |
| 15 * primary responsibility of this server is to listen for an UPGRADE request and | 15 * primary responsibility of this server is to listen for an UPGRADE request and |
| 16 * to start an analysis server. | 16 * to start an analysis server. |
| 17 */ | 17 */ |
| 18 class HttpAnalysisServer { | 18 class HttpAnalysisServer { |
| 19 /** | 19 /** |
| 20 * An object that can handle either a WebSocket connection or a connection | 20 * An object that can handle either a WebSocket connection or a connection |
| 21 * to the client over stdio. | 21 * to the client over stdio. |
| 22 */ | 22 */ |
| 23 SocketServer socketServer = new SocketServer(); | 23 SocketServer socketServer; |
| 24 | 24 |
| 25 /** | 25 /** |
| 26 * An object that can handle GET requests. | 26 * An object that can handle GET requests. |
| 27 */ | 27 */ |
| 28 GetHandler getHandler; | 28 GetHandler getHandler; |
| 29 | 29 |
| 30 /** | 30 /** |
| 31 * Initialize a newly created HTTP server. | 31 * Initialize a newly created HTTP server. |
| 32 */ | 32 */ |
| 33 HttpAnalysisServer(this.socketServer); | 33 HttpAnalysisServer(this.socketServer); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 } | 81 } |
| 82 | 82 |
| 83 /** | 83 /** |
| 84 * Begin serving HTTP requests over the given port. | 84 * Begin serving HTTP requests over the given port. |
| 85 */ | 85 */ |
| 86 void serveHttp(int port) { | 86 void serveHttp(int port) { |
| 87 HttpServer.bind(InternetAddress.LOOPBACK_IP_V4, port).then(_handleServer); | 87 HttpServer.bind(InternetAddress.LOOPBACK_IP_V4, port).then(_handleServer); |
| 88 print('Listening on port $port'); | 88 print('Listening on port $port'); |
| 89 } | 89 } |
| 90 } | 90 } |
| OLD | NEW |