Closed
Description
Tareq Abedrabbo opened SPR-5516 and commented
The RestTemplate does not encode the url variables. The following line:
template.postForLocation("http://twitter.com/statuses/update.xml?status={status}", "", "Ho Ho");
Results in an exception:
Exception in thread "main" java.lang.IllegalArgumentException
at java.net.URI.create(URI.java:842)
at org.springframework.web.util.UriTemplate.expand(UriTemplate.java:140)
at org.springframework.web.client.core.RestTemplate.execute(RestTemplate.java:266)
at org.springframework.web.client.core.RestTemplate.postForLocation(RestTemplate.java:203)
at test.RestClientTest.main(RestClientTest.java:30)
Caused by: java.net.URISyntaxException: Illegal character in query at index 48: http://twitter.com/statuses/update.xml?status=Ho Ho
at java.net.URI$Parser.fail(URI.java:2809)
at java.net.URI$Parser.checkChars(URI.java:2982)
at java.net.URI$Parser.parseHierarchical(URI.java:3072)
at java.net.URI$Parser.parse(URI.java:3014)
at java.net.URI.<init>(URI.java:578)
at java.net.URI.create(URI.java:840)
... 4 more
Affects: 3.0 M2
Issue Links:
- Unable to retrieve FlashMap when contains "+"(half-space) in the request parameters [SPR-11821] #16441 Unable to retrieve FlashMap when contains "+"(half-space) in the request parameters
- UrlPathHelper is too aggressive decoding URLs [SPR-6291] #10957 UrlPathHelper is too aggressive decoding URLs
- Spring:url tag should not use application/x-www-form-urlencoded encoding [SPR-6296] #10962 Spring:url tag should not use application/x-www-form-urlencoded encoding
0 votes, 5 watchers