HTTP Outobund: Call encode() for URIs

* Encoding in AbstractHttpRequestExecutingMessageHandler.java is now done when flag is set

* Added test for URI Encoding

* Fixed checkstyle violations

**Cherry-pick to 5.1.x**
This commit is contained in:
Florian Schöffl
2019-05-16 19:50:02 +02:00
committed by Artem Bilan
parent 9f53b80e18
commit 87169bc77a
2 changed files with 51 additions and 1 deletions

View File

@@ -73,6 +73,7 @@ import org.springframework.web.util.UriComponentsBuilder;
* @author Artem Bilan
* @author Wallace Wadge
* @author Shiliang Li
* @author Florian Schöffl
*
* @since 5.0
*/
@@ -301,7 +302,7 @@ public abstract class AbstractHttpRequestExecutingMessageHandler extends Abstrac
: UriComponentsBuilder.fromUri((URI) uri);
UriComponents uriComponents = uriComponentsBuilder.buildAndExpand(uriVariables);
try {
return this.encodeUri ? uriComponents.toUri() : new URI(uriComponents.toUriString());
return this.encodeUri ? uriComponents.encode().toUri() : new URI(uriComponents.toUriString());
}
catch (URISyntaxException e) {
throw new MessageHandlingException(requestMessage, "Invalid URI [" + uri + "]", e);