Skip to content

Commit bb5b12a

Browse files
committed
UriComponentsBuilder Javadoc update
Closes gh-25604
1 parent 2f75212 commit bb5b12a

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
@@ -162,7 +162,13 @@ public static UriComponentsBuilder fromPath(String path) {
162162
}
163163

164164
/**
165-
* Create a builder that is initialized with the given {@code URI}.
165+
* Create a builder that is initialized from the given {@code URI}.
166+
* <p><strong>Note:</strong> the components in the resulting builder will be
167+
* in fully encoded (raw) form and further changes must also supply values
168+
* that are fully encoded, for example via methods in {@link UriUtils}.
169+
* In addition please use {@link #build(boolean)} with a value of "true" to
170+
* build the {@link UriComponents} instance in order to indicate that the
171+
* components are encoded.
166172
* @param uri the URI to initialize with
167173
* @return the new {@code UriComponentsBuilder}
168174
*/
@@ -328,11 +334,13 @@ public UriComponents build() {
328334
}
329335

330336
/**
331-
* Build a {@code UriComponents} instance from the various components
332-
* contained in this builder.
333-
* @param encoded whether all the components set in this builder are
334-
* encoded ({@code true}) or not ({@code false})
337+
* Variant of {@link #build()} to create a {@link UriComponents} instance
338+
* when components are already fully encoded. This is useful for example if
339+
* the builder was created via {@link UriComponentsBuilder#fromUri(URI)}.
340+
* @param encoded whether the components in this builder are already encoded
335341
* @return the URI components
342+
* @throws IllegalArgumentException if any of the components contain illegal
343+
* characters that should have been encoded.
336344
*/
337345
public UriComponents build(boolean encoded) {
338346
if (this.ssp != null) {

0 commit comments

Comments
 (0)