File tree Expand file tree Collapse file tree 2 files changed +17
-6
lines changed
org.springframework.web/src
main/java/org/springframework/web/util
test/java/org/springframework/web/util Expand file tree Collapse file tree 2 files changed +17
-6
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2009 the original author or authors.
2
+ * Copyright 2002-2010 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
36
36
*
37
37
* @author Arjen Poutsma
38
38
* @author Juergen Hoeller
39
- * @see <a href="http://bitworking.org/projects/URI-Templates/">URI Templates</a>
40
39
* @since 3.0
40
+ * @see <a href="http://bitworking.org/projects/URI-Templates/">URI Templates</a>
41
41
*/
42
42
public class UriTemplate {
43
43
@@ -126,7 +126,7 @@ public URI expand(Object... uriVariableValues) {
126
126
int i = 0 ;
127
127
while (matcher .find ()) {
128
128
String uriVariable = uriVariableValues [i ++].toString ();
129
- matcher .appendReplacement (buffer , uriVariable );
129
+ matcher .appendReplacement (buffer , Matcher . quoteReplacement ( uriVariable ) );
130
130
}
131
131
matcher .appendTail (buffer );
132
132
return encodeUri (buffer .toString ());
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2009 the original author or authors.
2
+ * Copyright 2002-2010 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
26
26
import static org .junit .Assert .*;
27
27
import org .junit .Test ;
28
28
29
- /** @author Arjen Poutsma */
29
+ /**
30
+ * @author Arjen Poutsma
31
+ * @author Juergen Hoeller
32
+ */
30
33
public class UriTemplateTests {
31
34
32
35
@ Test
@@ -141,4 +144,12 @@ public void fragments() throws Exception {
141
144
template = new UriTemplate ("/search?query={query}#{fragment}" );
142
145
assertTrue (template .matches ("/search?query=foo#bar" ));
143
146
}
144
- }
147
+
148
+ @ Test
149
+ public void expandWithDollar () {
150
+ UriTemplate template = new UriTemplate ("/{a}" );
151
+ URI uri = template .expand ("$replacement" );
152
+ assertEquals ("/$replacement" , uri .toString ());
153
+ }
154
+
155
+ }
You can’t perform that action at this time.
0 commit comments