File tree Expand file tree Collapse file tree 3 files changed +20
-9
lines changed
build-spring-framework/resources
org.springframework.web/src
main/java/org/springframework/web/util
test/java/org/springframework/web/util Expand file tree Collapse file tree 3 files changed +20
-9
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ Changes in version 3.1.2 (2012-06-??)
26
26
* fix issue with suffix pattern in AnnotationMethodHandlerAdapter
27
27
* merge rather than add URI vars in ExtendedServletRequestDataBinder
28
28
* raise RestClientException for unknown HTTP status codes
29
-
29
+ * fix issue with encoded params in UriComponentsBuilder
30
30
31
31
Changes in version 3.1.1 (2012-02-16)
32
32
-------------------------------------
Original file line number Diff line number Diff line change @@ -260,24 +260,24 @@ public UriComponentsBuilder uri(URI uri) {
260
260
261
261
this .scheme = uri .getScheme ();
262
262
263
- if (uri .getUserInfo () != null ) {
264
- this .userInfo = uri .getUserInfo ();
263
+ if (uri .getRawUserInfo () != null ) {
264
+ this .userInfo = uri .getRawUserInfo ();
265
265
}
266
266
if (uri .getHost () != null ) {
267
267
this .host = uri .getHost ();
268
268
}
269
269
if (uri .getPort () != -1 ) {
270
270
this .port = uri .getPort ();
271
271
}
272
- if (StringUtils .hasLength (uri .getPath ())) {
273
- this .pathBuilder = new FullPathComponentBuilder (uri .getPath ());
272
+ if (StringUtils .hasLength (uri .getRawPath ())) {
273
+ this .pathBuilder = new FullPathComponentBuilder (uri .getRawPath ());
274
274
}
275
- if (StringUtils .hasLength (uri .getQuery ())) {
275
+ if (StringUtils .hasLength (uri .getRawQuery ())) {
276
276
this .queryParams .clear ();
277
- query (uri .getQuery ());
277
+ query (uri .getRawQuery ());
278
278
}
279
- if (uri .getFragment () != null ) {
280
- this .fragment = uri .getFragment ();
279
+ if (uri .getRawFragment () != null ) {
280
+ this .fragment = uri .getRawFragment ();
281
281
}
282
282
return this ;
283
283
}
Original file line number Diff line number Diff line change @@ -76,6 +76,17 @@ public void fromUri() throws URISyntaxException {
76
76
assertEquals ("Invalid result URI" , uri , result .toUri ());
77
77
}
78
78
79
+ // SPR-9317
80
+
81
+ @ Test
82
+ public void fromUriEncodedQuery () throws URISyntaxException {
83
+ URI uri = new URI ("http://www.example.org/?param=aGVsbG9Xb3JsZA%3D%3D" );
84
+ String fromUri = UriComponentsBuilder .fromUri (uri ).build ().getQueryParams ().get ("param" ).get (0 );
85
+ String fromUriString = UriComponentsBuilder .fromUriString (uri .toString ()).build ().getQueryParams ().get ("param" ).get (0 );
86
+
87
+ assertEquals (fromUri , fromUriString );
88
+ }
89
+
79
90
@ Test
80
91
public void fromUriString () {
81
92
UriComponents result = UriComponentsBuilder .fromUriString ("http://www.ietf.org/rfc/rfc3986.txt" ).build ();
You can’t perform that action at this time.
0 commit comments