@@ -182,7 +182,13 @@ public static UriComponentsBuilder fromPath(String path) {
182
182
}
183
183
184
184
/**
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.
186
192
* @param uri the URI to initialize with
187
193
* @return the new {@code UriComponentsBuilder}
188
194
*/
@@ -379,11 +385,13 @@ public UriComponents build() {
379
385
}
380
386
381
387
/**
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
386
392
* @return the URI components
393
+ * @throws IllegalArgumentException if any of the components contain illegal
394
+ * characters that should have been encoded.
387
395
*/
388
396
public UriComponents build (boolean encoded ) {
389
397
return buildInternal (encoded ?
0 commit comments