OLD | NEW |
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 part of vmservice_io; | 5 part of vmservice_io; |
6 | 6 |
7 final bool silentObservatory = const bool.fromEnvironment('SILENT_OBSERVATORY'); | 7 final bool silentObservatory = const bool.fromEnvironment('SILENT_OBSERVATORY'); |
8 | 8 |
9 void serverPrint(String s) { | 9 void serverPrint(String s) { |
10 if (silentObservatory) { | 10 if (silentObservatory) { |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 return; | 289 return; |
290 } | 290 } |
291 | 291 |
292 if (path == WEBSOCKET_PATH) { | 292 if (path == WEBSOCKET_PATH) { |
293 WebSocketTransformer.upgrade(request).then((WebSocket webSocket) { | 293 WebSocketTransformer.upgrade(request).then((WebSocket webSocket) { |
294 new WebSocketClient(webSocket, _service); | 294 new WebSocketClient(webSocket, _service); |
295 }); | 295 }); |
296 return; | 296 return; |
297 } | 297 } |
298 | 298 |
| 299 if (assets == null) { |
| 300 request.response.headers.contentType = ContentType.TEXT; |
| 301 request.response.write("This VM was built without the Observatory UI."); |
| 302 request.response.close(); |
| 303 return; |
| 304 } |
299 Asset asset = assets[path]; | 305 Asset asset = assets[path]; |
300 if (asset != null) { | 306 if (asset != null) { |
301 // Serving up a static asset (e.g. .css, .html, .png). | 307 // Serving up a static asset (e.g. .css, .html, .png). |
302 request.response.headers.contentType = ContentType.parse(asset.mimeType); | 308 request.response.headers.contentType = ContentType.parse(asset.mimeType); |
303 request.response.add(asset.data); | 309 request.response.add(asset.data); |
304 request.response.close(); | 310 request.response.close(); |
305 return; | 311 return; |
306 } | 312 } |
307 // HTTP based service request. | 313 // HTTP based service request. |
308 try { | 314 try { |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 _server = null; | 415 _server = null; |
410 serverPrint('Could not shutdown Observatory HTTP server:\n$e\n$st\n'); | 416 serverPrint('Could not shutdown Observatory HTTP server:\n$e\n$st\n'); |
411 _notifyServerState(""); | 417 _notifyServerState(""); |
412 onServerAddressChange(null); | 418 onServerAddressChange(null); |
413 return this; | 419 return this; |
414 }); | 420 }); |
415 } | 421 } |
416 } | 422 } |
417 | 423 |
418 void _notifyServerState(String uri) native "VMServiceIO_NotifyServerState"; | 424 void _notifyServerState(String uri) native "VMServiceIO_NotifyServerState"; |
OLD | NEW |