Chromium Code Reviews| 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; | 5 part of vmservice; |
| 6 | 6 |
| 7 class ServiceRequest { | 7 class ServiceRequest { |
| 8 final List<String> pathSegments = new List<String>(); | 8 final List<String> pathSegments = new List<String>(); |
| 9 final Map<String, String> parameters = new Map<String, String>(); | 9 final Map<String, String> parameters = new Map<String, String>(); |
| 10 String _response; | 10 String _response; |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 24 continue; | 24 continue; |
| 25 } | 25 } |
| 26 pathSegments.add(pathSegment); | 26 pathSegments.add(pathSegment); |
| 27 } | 27 } |
| 28 uri.queryParameters.forEach((k, v) { | 28 uri.queryParameters.forEach((k, v) { |
| 29 parameters[k] = v; | 29 parameters[k] = v; |
| 30 }); | 30 }); |
| 31 return true; | 31 return true; |
| 32 } | 32 } |
| 33 | 33 |
| 34 String toServiceCallMessage() { | 34 List toServiceCallMessage() { |
| 35 return JSON.stringify({ | 35 var m = []; |
| 36 'p': pathSegments, | 36 m.add(pathSegments); |
| 37 'k': parameters.keys.toList(), | 37 m.add(parameters.keys.toList()); |
| 38 'v': parameters.values.toList() | 38 m.add(parameters.values.toList()); |
|
siva
2013/08/01 18:16:18
Might be more readable and more efficient as:
ret
Cutch
2013/08/01 22:22:04
Done.
| |
| 39 }); | 39 return m; |
| 40 } | 40 } |
| 41 | 41 |
| 42 void setErrorResponse(String error) { | 42 void setErrorResponse(String error) { |
| 43 _response = JSON.stringify({ | 43 _response = JSON.stringify({ |
| 44 'error': error, | 44 'type': 'error', |
| 45 'msg': error, | |
| 45 'pathSegments': pathSegments, | 46 'pathSegments': pathSegments, |
| 46 'parameters': parameters | 47 'parameters': parameters |
| 47 }); | 48 }); |
| 48 } | 49 } |
| 49 | 50 |
| 50 void setResponse(String response) { | 51 void setResponse(String response) { |
| 51 _response = response; | 52 _response = response; |
| 52 } | 53 } |
| 53 | 54 |
| 54 } | 55 } |
| OLD | NEW |