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

Unified Diff: runtime/bin/vmservice/service_request.dart

Issue 19622003: VM Service isolate listing (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/vmservice/server.dart ('k') | runtime/bin/vmservice/service_request_router.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/vmservice/service_request.dart
diff --git a/runtime/bin/vmservice/service_request.dart b/runtime/bin/vmservice/service_request.dart
new file mode 100644
index 0000000000000000000000000000000000000000..83f26db03a728e372ee76f3a9c51e99ea74bd7d3
--- /dev/null
+++ b/runtime/bin/vmservice/service_request.dart
@@ -0,0 +1,54 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+part of vmservice;
+
+class ServiceRequest {
+ final List<String> pathSegments = new List<String>();
+ final Map<String, String> parameters = new Map<String, String>();
+ String _response;
+ String get response => _response;
+
+ ServiceRequest();
+
+ bool parse(Uri uri) {
+ var path = uri.path;
+ var split = path.split('/');
+ if (split.length == 0) {
+ return false;
+ }
+ for (int i = 0; i < split.length; i++) {
+ var pathSegment = split[i];
+ if (pathSegment == '') {
+ continue;
+ }
+ pathSegments.add(pathSegment);
+ }
+ uri.queryParameters.forEach((k, v) {
+ parameters[k] = v;
+ });
+ return true;
+ }
+
+ String toServiceCallMessage() {
+ return JSON.stringify({
+ 'p': pathSegments,
+ 'k': parameters.keys.toList(),
+ 'v': parameters.values.toList()
+ });
+ }
+
+ void setErrorResponse(String error) {
+ _response = JSON.stringify({
+ 'error': error,
+ 'pathSegments': pathSegments,
+ 'parameters': parameters
+ });
+ }
+
+ void setResponse(String response) {
+ _response = response;
+ }
+
+}
« no previous file with comments | « runtime/bin/vmservice/server.dart ('k') | runtime/bin/vmservice/service_request_router.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698