| 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 import 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'dart:io'; | 6 import 'dart:io'; |
| 7 | 7 |
| 8 import 'package:analysis_server/src/socket_server.dart'; | 8 import 'package:analysis_server/src/socket_server.dart'; |
| 9 import 'package:analysis_server/src/status/diagnostics.dart'; | 9 import 'package:analysis_server/src/status/diagnostics.dart'; |
| 10 | 10 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 | 119 |
| 120 return null; | 120 return null; |
| 121 } | 121 } |
| 122 } | 122 } |
| 123 | 123 |
| 124 /** | 124 /** |
| 125 * Handle a GET request received by the HTTP server. | 125 * Handle a GET request received by the HTTP server. |
| 126 */ | 126 */ |
| 127 Future<Null> _handleGetRequest(HttpRequest request) async { | 127 Future<Null> _handleGetRequest(HttpRequest request) async { |
| 128 if (getHandler == null) { | 128 if (getHandler == null) { |
| 129 if (socketServer.analysisServer.options.enableNewAnalysisDriver) { | 129 getHandler = new DiagnosticsSite(socketServer, _printBuffer); |
| 130 getHandler = new DiagnosticsSite(socketServer, _printBuffer); | |
| 131 } else { | |
| 132 getHandler = new ErrorGetHandler( | |
| 133 'Diagnostics only supported for the new analysis driver.'); | |
| 134 } | |
| 135 } | 130 } |
| 136 await getHandler.handleGetRequest(request); | 131 await getHandler.handleGetRequest(request); |
| 137 } | 132 } |
| 138 | 133 |
| 139 /** | 134 /** |
| 140 * Attach a listener to a newly created HTTP server. | 135 * Attach a listener to a newly created HTTP server. |
| 141 */ | 136 */ |
| 142 void _handleServer(HttpServer httpServer) { | 137 void _handleServer(HttpServer httpServer) { |
| 143 httpServer.listen((HttpRequest request) async { | 138 httpServer.listen((HttpRequest request) async { |
| 144 List<String> updateValues = request.headers[HttpHeaders.UPGRADE]; | 139 List<String> updateValues = request.headers[HttpHeaders.UPGRADE]; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 165 * server. | 160 * server. |
| 166 */ | 161 */ |
| 167 void _returnUnknownRequest(HttpRequest request) { | 162 void _returnUnknownRequest(HttpRequest request) { |
| 168 HttpResponse response = request.response; | 163 HttpResponse response = request.response; |
| 169 response.statusCode = HttpStatus.NOT_FOUND; | 164 response.statusCode = HttpStatus.NOT_FOUND; |
| 170 response.headers.contentType = ContentType.TEXT; | 165 response.headers.contentType = ContentType.TEXT; |
| 171 response.write('Not found'); | 166 response.write('Not found'); |
| 172 response.close(); | 167 response.close(); |
| 173 } | 168 } |
| 174 } | 169 } |
| OLD | NEW |