OLD | NEW |
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 part of utilslib; | 5 part of utilslib; |
6 | 6 |
7 /** | 7 /** |
8 * A parsed URI, inspired by: | 8 * A parsed URI, inspired by: |
9 * http://closure-library.googlecode.com/svn/docs/class_goog_Uri.html | 9 * http://closure-library.googlecode.com/svn/docs/class_goog_Uri.html |
10 */ | 10 */ |
11 class Uri extends uri.Uri { | 11 class Uri extends core.Uri { |
12 /** | 12 /** |
13 * Parses a URL query string into a map. Because you can have multiple values | 13 * Parses a URL query string into a map. Because you can have multiple values |
14 * for the same parameter name, each parameter name maps to a list of | 14 * for the same parameter name, each parameter name maps to a list of |
15 * values. For example, '?a=b&c=d&a=e' would be parsed as | 15 * values. For example, '?a=b&c=d&a=e' would be parsed as |
16 * [{'a':['b','e'],'c':['d']}]. | 16 * [{'a':['b','e'],'c':['d']}]. |
17 */ | 17 */ |
18 // TODO(jmesserly): consolidate with Uri.parse(...) | 18 // TODO(jmesserly): consolidate with Uri.parse(...) |
19 static Map<String, List<String>> parseQuery(String queryString) { | 19 static Map<String, List<String>> parseQuery(String queryString) { |
20 final queryParams = new Map<String, List<String>>(); | 20 final queryParams = new Map<String, List<String>>(); |
21 if (queryString.startsWith('?')) { | 21 if (queryString.startsWith('?')) { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 return component.replaceAll('%3A', ':') | 70 return component.replaceAll('%3A', ':') |
71 .replaceAll('%2F', '/') | 71 .replaceAll('%2F', '/') |
72 .replaceAll('%3F', '?') | 72 .replaceAll('%3F', '?') |
73 .replaceAll('%3D', '=') | 73 .replaceAll('%3D', '=') |
74 .replaceAll('%26', '&') | 74 .replaceAll('%26', '&') |
75 .replaceAll('%20', ' '); | 75 .replaceAll('%20', ' '); |
76 } | 76 } |
77 | 77 |
78 Uri(String uri) : super(uri); | 78 Uri(String uri) : super(uri); |
79 } | 79 } |
OLD | NEW |