| 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'; | 
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  122       getHandler.server = analysisServer; |  122       getHandler.server = analysisServer; | 
|  123     } |  123     } | 
|  124     getHandler.handleGetRequest(request); |  124     getHandler.handleGetRequest(request); | 
|  125   } |  125   } | 
|  126  |  126  | 
|  127   /** |  127   /** | 
|  128    * Handle an UPGRADE request received by the HTTP server by creating and |  128    * Handle an UPGRADE request received by the HTTP server by creating and | 
|  129    * running an analysis server on a [WebSocket]-based communication channel. |  129    * running an analysis server on a [WebSocket]-based communication channel. | 
|  130    */ |  130    */ | 
|  131   void _handleWebSocket(WebSocket socket) { |  131   void _handleWebSocket(WebSocket socket) { | 
|  132     analysisServer = new AnalysisServer(new WebSocketChannel(socket)); |  132     analysisServer = new AnalysisServer(new WebSocketServerChannel(socket)); | 
|  133     _initializeHandlers(analysisServer); |  133     _initializeHandlers(analysisServer); | 
|  134     if (getHandler != null) { |  134     if (getHandler != null) { | 
|  135       getHandler.server = analysisServer; |  135       getHandler.server = analysisServer; | 
|  136     } |  136     } | 
|  137     analysisServer.run(); |  137     analysisServer.run(); | 
|  138   } |  138   } | 
|  139  |  139  | 
|  140   /** |  140   /** | 
|  141    * Initialize the handlers to be used by the given [server]. |  141    * Initialize the handlers to be used by the given [server]. | 
|  142    */ |  142    */ | 
| (...skipping 31 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 |