Skip to content

Commit ca6ac8e

Browse files
committed
UriComponentsBuilder Javadoc update
Closes gh-25604
1 parent aec3a4c commit ca6ac8e

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

spring-web/src/main/java/org/springframework/web/util/UriComponentsBuilder.java

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,13 @@ public static UriComponentsBuilder fromPath(String path) {
182182
}
183183

184184
/**
185-
* Create a builder that is initialized with the given {@code URI}.
185+
* Create a builder that is initialized from the given {@code URI}.
186+
* <p><strong>Note:</strong> the components in the resulting builder will be
187+
* in fully encoded (raw) form and further changes must also supply values
188+
* that are fully encoded, for example via methods in {@link UriUtils}.
189+
* In addition please use {@link #build(boolean)} with a value of "true" to
190+
* build the {@link UriComponents} instance in order to indicate that the
191+
* components are encoded.
186192
* @param uri the URI to initialize with
187193
* @return the new {@code UriComponentsBuilder}
188194
*/
@@ -379,11 +385,13 @@ public UriComponents build() {
379385
}
380386

381387
/**
382-
* Build a {@code UriComponents} instance from the various components
383-
* contained in this builder.
384-
* @param encoded whether all the components set in this builder are
385-
* encoded ({@code true}) or not ({@code false})
388+
* Variant of {@link #build()} to create a {@link UriComponents} instance
389+
* when components are already fully encoded. This is useful for example if
390+
* the builder was created via {@link UriComponentsBuilder#fromUri(URI)}.
391+
* @param encoded whether the components in this builder are already encoded
386392
* @return the URI components
393+
* @throws IllegalArgumentException if any of the components contain illegal
394+
* characters that should have been encoded.
387395
*/
388396
public UriComponents build(boolean encoded) {
389397
return buildInternal(encoded ?

0 commit comments

Comments
 (0)