@@ -186,7 +186,13 @@ public static UriComponentsBuilder fromPath(String path) {
186
186
}
187
187
188
188
/**
189
- * Create a builder that is initialized with the given {@code URI}.
189
+ * Create a builder that is initialized from the given {@code URI}.
190
+ * <p><strong>Note:</strong> the components in the resulting builder will be
191
+ * in fully encoded (raw) form and further changes must also supply values
192
+ * that are fully encoded, for example via methods in {@link UriUtils}.
193
+ * In addition please use {@link #build(boolean)} with a value of "true" to
194
+ * build the {@link UriComponents} instance in order to indicate that the
195
+ * components are encoded.
190
196
* @param uri the URI to initialize with
191
197
* @return the new {@code UriComponentsBuilder}
192
198
*/
@@ -387,11 +393,13 @@ public UriComponents build() {
387
393
}
388
394
389
395
/**
390
- * Build a {@code UriComponents} instance from the various components
391
- * contained in this builder.
392
- * @param encoded whether all the components set in this builder are
393
- * encoded ({@code true}) or not ({@code false})
396
+ * Variant of {@link #build()} to create a {@link UriComponents} instance
397
+ * when components are already fully encoded. This is useful for example if
398
+ * the builder was created via {@link UriComponentsBuilder#fromUri(URI)}.
399
+ * @param encoded whether the components in this builder are already encoded
394
400
* @return the URI components
401
+ * @throws IllegalArgumentException if any of the components contain illegal
402
+ * characters that should have been encoded.
395
403
*/
396
404
public UriComponents build (boolean encoded ) {
397
405
return buildInternal (encoded ?
0 commit comments