|
29 | 29 | * Expands URI Templates. |
30 | 30 | * |
31 | 31 | * This Class supports Level 1 templates and all Level 4 composite templates as described in: |
32 | | - * <a href="http://tools.ietf.org/html/draft-gregorio-uritemplate-07">URI Template</a>. |
| 32 | + * <a href="http://tools.ietf.org/html/rfc6570">RFC 6570</a>. |
33 | 33 | * |
34 | 34 | * Specifically, for the variables: |
35 | 35 | * var := "value" |
|
40 | 40 | * {var} -> value |
41 | 41 | * {list} -> red,green,blue |
42 | 42 | * {list*} -> red,green,blue |
43 | | - * {key} -> semi,%3B,dot,.,comma,%2C |
44 | | - * {key*} -> semi=%3B,dot=.,comma=%2C |
| 43 | + * {keys} -> semi,%3B,dot,.,comma,%2C |
| 44 | + * {keys*} -> semi=%3B,dot=.,comma=%2C |
45 | 45 | * {+list} -> red,green,blue |
46 | 46 | * {+list*} -> red,green,blue |
47 | | - * {+key} -> semi,;,dot,.,comma,, |
48 | | - * {+key*} -> semi=;,dot=.,comma=, |
| 47 | + * {+keys} -> semi,;,dot,.,comma,, |
| 48 | + * {+keys*} -> semi=;,dot=.,comma=, |
49 | 49 | * {#list} -> #red,green,blue |
50 | 50 | * {#list*} -> #red,green,blue |
51 | | - * {#key} -> #semi,;,dot,.,comma,, |
52 | | - * {#key*} -> #semi=;,dot=.,comma=, |
| 51 | + * {#keys} -> #semi,;,dot,.,comma,, |
| 52 | + * {#keys*} -> #semi=;,dot=.,comma=, |
53 | 53 | * X{.list} -> X.red,green,blue |
54 | 54 | * X{.list*} -> X.red.green.blue |
55 | | - * X{.key} - > X.semi,%3B,dot,.,comma,%2C |
56 | | - * X{.key*} -> X.semi=%3B.dot=..comma=%2C |
| 55 | + * X{.keys} -> X.semi,%3B,dot,.,comma,%2C |
| 56 | + * X{.keys*} -> X.semi=%3B.dot=..comma=%2C |
57 | 57 | * {/list} -> /red,green,blue |
58 | 58 | * {/list*} -> /red/green/blue |
59 | | - * {/key} -> /semi,%3B,dot,.,comma,%2C |
60 | | - * {/key*} -> /semi=%3B/dot=./comma=%2C |
| 59 | + * {/keys} -> /semi,%3B,dot,.,comma,%2C |
| 60 | + * {/keys*} -> /semi=%3B/dot=./comma=%2C |
61 | 61 | * {;list} -> ;list=red,green,blue |
62 | | - * {;list*} -> ;red;green;blue |
63 | | - * {;key} -> ;keys=semi,%3B,dot,.,comma,%2C |
64 | | - * {;key*} -> ;semi=%3B;dot=.;comma=%2C |
| 62 | + * {;list*} -> ;list=red;list=green;list=blue |
| 63 | + * {;keys} -> ;keys=semi,%3B,dot,.,comma,%2C |
| 64 | + * {;keys*} -> ;semi=%3B;dot=.;comma=%2C |
65 | 65 | * {?list} -> ?list=red,green,blue |
66 | | - * {?list*} -> ?red&green&blue |
67 | | - * {?key} -> ?keys=semi,%3B,dot,.,comma,%2C |
68 | | - * {?key*} -> ?semi=%3B&dot=.&comma=%2C |
| 66 | + * {?list*} -> ?list=red&list=green&list=blue |
| 67 | + * {?keys} -> ?keys=semi,%3B,dot,.,comma,%2C |
| 68 | + * {?keys*} -> ?semi=%3B&dot=.&comma=%2C |
69 | 69 | * {&list} -> &list=red,green,blue |
70 | | - * {&list*} -> &red&green&blue |
71 | | - * {&key} -> &keys=semi,%3B,dot,.,comma,%2C |
72 | | - * {&key*} -> &semi=%3B&dot=.&comma=%2C |
| 70 | + * {&list*} -> &list=red&list=green&list=blue |
| 71 | + * {&keys} -> &keys=semi,%3B,dot,.,comma,%2C |
| 72 | + * {&keys*} -> &semi=%3B&dot=.&comma=%2C |
73 | 73 | * |
74 | 74 | * @since 1.6 |
75 | 75 | * @author Ravi Mistry |
@@ -226,7 +226,7 @@ private static Map<String, Object> getMap(Object obj) { |
226 | 226 | * |
227 | 227 | * <p> |
228 | 228 | * Supports Level 1 templates and all Level 4 composite templates as described in: |
229 | | - * <a href="http://tools.ietf.org/html/draft-gregorio-uritemplate-07">URI Template</a>. |
| 229 | + * <a href="http://tools.ietf.org/html/rfc6570">RFC 6570</a>. |
230 | 230 | * </p> |
231 | 231 | * |
232 | 232 | * @param baseUrl The base URL which the URI component is relative to. |
@@ -260,7 +260,7 @@ public static String expand(String baseUrl, String uriTemplate, Object parameter |
260 | 260 | * |
261 | 261 | * <p> |
262 | 262 | * Supports Level 1 templates and all Level 4 composite templates as described in: |
263 | | - * <a href="http://tools.ietf.org/html/draft-gregorio-uritemplate-07">URI Template</a>. |
| 263 | + * <a href="http://tools.ietf.org/html/rfc6570">RFC 6570</a>. |
264 | 264 | * </p> |
265 | 265 | * |
266 | 266 | * @param pathUri URI component. It may contain one or more sequences of the form "{name}", where |
@@ -371,6 +371,10 @@ private static String getListPropertyValue(String varName, Iterator<?> iterator, |
371 | 371 | } |
372 | 372 | } |
373 | 373 | while (iterator.hasNext()) { |
| 374 | + if (containsExplodeModifier && compositeOutput.requiresVarAssignment()) { |
| 375 | + retBuf.append(CharEscapers.escapeUriPath(varName)); |
| 376 | + retBuf.append("="); |
| 377 | + } |
374 | 378 | retBuf.append(compositeOutput.getEncodedValue(iterator.next().toString())); |
375 | 379 | if (iterator.hasNext()) { |
376 | 380 | retBuf.append(joiner); |
|
0 commit comments