@@ -162,7 +162,13 @@ public static UriComponentsBuilder fromPath(String path) {
162
162
}
163
163
164
164
/**
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.
166
172
* @param uri the URI to initialize with
167
173
* @return the new {@code UriComponentsBuilder}
168
174
*/
@@ -328,11 +334,13 @@ public UriComponents build() {
328
334
}
329
335
330
336
/**
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
335
341
* @return the URI components
342
+ * @throws IllegalArgumentException if any of the components contain illegal
343
+ * characters that should have been encoded.
336
344
*/
337
345
public UriComponents build (boolean encoded ) {
338
346
if (this .ssp != null ) {
0 commit comments