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

Side by Side Diff: dart/samples/dartiverse_search/bin/server.dart

Issue 68633002: Version 1.0.0.2 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 1 month 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/editor/build/promote.py ('k') | dart/samples/dartiverse_search/web/client.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 dartiverse_search; 5 library dartiverse_search;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:convert'; 8 import 'dart:convert';
9 import 'dart:io'; 9 import 'dart:io';
10 10
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 // Set up default handler. This will serve files from our 'build' directory. 109 // Set up default handler. This will serve files from our 'build' directory.
110 var virDir = new http_server.VirtualDirectory(buildPath); 110 var virDir = new http_server.VirtualDirectory(buildPath);
111 // Disable jail-root, as packages are local sym-links. 111 // Disable jail-root, as packages are local sym-links.
112 virDir.jailRoot = false; 112 virDir.jailRoot = false;
113 virDir.allowDirectoryListing = true; 113 virDir.allowDirectoryListing = true;
114 virDir.directoryHandler = (dir, request) { 114 virDir.directoryHandler = (dir, request) {
115 // Redirect directory-requests to index.html files. 115 // Redirect directory-requests to index.html files.
116 var indexUri = new Uri.file(dir.path).resolve('index.html'); 116 var indexUri = new Uri.file(dir.path).resolve('index.html');
117 virDir.serveFile(new File(indexUri.toFilePath()), request); 117 virDir.serveFile(new File(indexUri.toFilePath()), request);
118 }; 118 };
119
120 // Add an error page handler.
121 virDir.errorPageHandler = (HttpRequest request) {
122 log.warning("Resource not found ${request.uri.path}");
123 request.response.statusCode = HttpStatus.NOT_FOUND;
124 request.response.close();
125 };
126
127 // Serve everything not routed elsewhere through the virtual directory.
119 virDir.serve(router.defaultStream); 128 virDir.serve(router.defaultStream);
129
130 // Special handling of client.dart. Running 'pub build' generates
131 // JavaScript files but does not copy the Dart files, which are
132 // needed for the Dartium browser.
133 router.serve("/client.dart").listen((request) {
134 Uri clientScript = Platform.script.resolve("../web/client.dart");
135 virDir.serveFile(new File(clientScript.toFilePath()), request);
136 });
120 }); 137 });
121 } 138 }
OLDNEW
« no previous file with comments | « dart/editor/build/promote.py ('k') | dart/samples/dartiverse_search/web/client.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698