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/analysis_server.dart'; | 9 import 'package:analysis_server/src/analysis_server.dart'; |
10 import 'package:analysis_server/src/channel.dart'; | 10 import 'package:analysis_server/src/channel.dart'; |
11 import 'package:analysis_server/src/domain_context.dart'; | 11 import 'package:analysis_server/src/domain_context.dart'; |
12 import 'package:analysis_server/src/domain_server.dart'; | 12 import 'package:analysis_server/src/domain_server.dart'; |
13 import 'package:analysis_server/src/get_handler.dart'; | 13 import 'package:analysis_server/src/get_handler.dart'; |
14 import 'package:args/args.dart'; | 14 import 'package:args/args.dart'; |
15 | 15 |
16 /** | 16 /** |
17 * Instances of the class [HttpServer] implement a simple HTTP server. The | 17 * Instances of the class [HttpServer] implement a simple HTTP server. The |
18 * primary responsibility of this server is to listen for an UPGRADE request and | 18 * primary responsibility of this server is to listen for an UPGRADE request and |
19 * to start an analysis server | 19 * to start an analysis server. |
20 */ | 20 */ |
21 class HttpAnalysisServer { | 21 class HttpAnalysisServer { |
22 /** | 22 /** |
23 * The name of the application that is used to start a server. | 23 * The name of the application that is used to start a server. |
24 */ | 24 */ |
25 static const BINARY_NAME = 'server'; | 25 static const BINARY_NAME = 'server'; |
26 | 26 |
27 /** | 27 /** |
28 * The name of the option used to print usage information. | 28 * The name of the option used to print usage information. |
29 */ | 29 */ |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 * server. | 174 * server. |
175 */ | 175 */ |
176 void _returnUnknownRequest(HttpRequest request) { | 176 void _returnUnknownRequest(HttpRequest request) { |
177 HttpResponse response = request.response; | 177 HttpResponse response = request.response; |
178 response.statusCode = HttpStatus.NOT_FOUND; | 178 response.statusCode = HttpStatus.NOT_FOUND; |
179 response.headers.add(HttpHeaders.CONTENT_TYPE, "text/plain"); | 179 response.headers.add(HttpHeaders.CONTENT_TYPE, "text/plain"); |
180 response.write('Not found'); | 180 response.write('Not found'); |
181 response.close(); | 181 response.close(); |
182 } | 182 } |
183 } | 183 } |
OLD | NEW |