Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(472)

Side by Side Diff: dart/site/try/project_server.dart

Issue 225903003: Tokenize one line at a time. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address Kasper's comments Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « dart/site/try/nossl.appcache ('k') | dart/site/try/src/interaction_manager.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 trydart.projectServer; 5 library trydart.projectServer;
6 6
7 import 'dart:io'; 7 import 'dart:io';
8 8
9 import 'dart:async' show 9 import 'dart:async' show
10 Future; 10 Future,
11 Stream;
11 12
12 import 'dart:convert' show 13 import 'dart:convert' show
13 HtmlEscape, 14 HtmlEscape,
14 JSON, 15 JSON,
15 UTF8; 16 UTF8;
16 17
17 class WatchHandler { 18 class WatchHandler {
18 final WebSocket socket; 19 final WebSocket socket;
19 20
20 final Set<String> watchedFiles; 21 final Set<String> watchedFiles;
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 print('Request for ${request.uri} ${response.statusCode}'); 139 print('Request for ${request.uri} ${response.statusCode}');
139 } 140 }
140 141
141 notFound(path) { 142 notFound(path) {
142 response.statusCode = HttpStatus.NOT_FOUND; 143 response.statusCode = HttpStatus.NOT_FOUND;
143 response.write(htmlInfo('Not Found', 144 response.write(htmlInfo('Not Found',
144 'The file "$path" could not be found.')); 145 'The file "$path" could not be found.'));
145 response.close(); 146 response.close();
146 } 147 }
147 148
148 redirect(String location) {
149 response.statusCode = HttpStatus.FOUND;
150 response.headers.add(HttpHeaders.LOCATION, location);
151 response.close();
152 }
153
154 badRequest(String problem) { 149 badRequest(String problem) {
155 response.statusCode = HttpStatus.BAD_REQUEST; 150 response.statusCode = HttpStatus.BAD_REQUEST;
156 response.write(htmlInfo("Bad request", 151 response.write(htmlInfo("Bad request",
157 "Bad request '${request.uri}': $problem")); 152 "Bad request '${request.uri}': $problem"));
158 response.close(); 153 response.close();
159 } 154 }
160 155
161 internalError(error, stack) { 156 internalError(error, stack) {
162 print(error); 157 print(error);
163 if (stack != null) print(stack); 158 if (stack != null) print(stack);
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 Conversation.packageRoot = Uri.base.resolve(arguments[4]); 446 Conversation.packageRoot = Uri.base.resolve(arguments[4]);
452 } 447 }
453 HttpServer.bind(host, port).then((HttpServer server) { 448 HttpServer.bind(host, port).then((HttpServer server) {
454 print('HTTP server started on http://$host:${server.port}/'); 449 print('HTTP server started on http://$host:${server.port}/');
455 server.listen(Conversation.onRequest, onError: Conversation.onError); 450 server.listen(Conversation.onRequest, onError: Conversation.onError);
456 }).catchError((e) { 451 }).catchError((e) {
457 print("HttpServer.bind error: $e"); 452 print("HttpServer.bind error: $e");
458 exit(1); 453 exit(1);
459 }); 454 });
460 } 455 }
OLDNEW
« no previous file with comments | « dart/site/try/nossl.appcache ('k') | dart/site/try/src/interaction_manager.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698