DefaultWebClient exposes full URI template as request attribute

Closes gh-30027
This commit is contained in:
Rossen Stoyanchev
2023-12-06 10:16:16 +00:00
committed by rstoyanchev
parent dd23b1d156
commit 2e07f9ab33
6 changed files with 31 additions and 7 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -410,6 +410,11 @@ public class DefaultUriBuilderFactory implements UriBuilderFactory {
}
return URI.create(uric.toString());
}
@Override
public String toUriString() {
return this.uriComponentsBuilder.build().toUriString();
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -270,4 +270,13 @@ public interface UriBuilder {
*/
URI build(Map<String, ?> uriVariables);
/**
* Return a String representation of the URI by concatenating all URI
* component values into the fully formed URI String. Implementing classes
* should perform simple String concatenation of current URI component
* values to preserve URI template placeholders.
* @since 6.1.2
*/
String toUriString();
}

View File

@@ -501,7 +501,8 @@ public class UriComponentsBuilder implements UriBuilder, Cloneable {
* @see UriComponents#toUriString()
*/
public String toUriString() {
return (this.uriVariables.isEmpty() ? build().encode().toUriString() :
return (this.uriVariables.isEmpty() ?
build().encode().toUriString() :
buildInternal(EncodingHint.ENCODE_TEMPLATE).toUriString());
}