/** * Set or append individual URI components of this builder from the values * of the given {@link UriComponents} instance. * <p>For the semantics of each component (i.e. set vs append) check the * builder methods on this class. For example {@link #host(String)} sets * while {@link #path(String)} appends. * @param uriComponents the UriComponents to copy from * @return this UriComponentsBuilder */ public UriComponentsBuilder uriComponents(UriComponents uriComponents) { Assert.notNull(uriComponents, "UriComponents must not be null"); uriComponents.copyToUriComponentsBuilder(this); return this; }
/** * Set or append individual URI components of this builder from the values * of the given {@link UriComponents} instance. * <p>For the semantics of each component (i.e. set vs append) check the * builder methods on this class. For example {@link #host(String)} sets * while {@link #path(String)} appends. * @param uriComponents the UriComponents to copy from * @return this UriComponentsBuilder */ public UriComponentsBuilder uriComponents(UriComponents uriComponents) { Assert.notNull(uriComponents, "UriComponents must not be null"); uriComponents.copyToUriComponentsBuilder(this); return this; }
@Test public void copyToUriComponentsBuilder() { UriComponents source = UriComponentsBuilder.fromPath("/foo/bar").pathSegment("ba/z").build(); UriComponentsBuilder targetBuilder = UriComponentsBuilder.newInstance(); source.copyToUriComponentsBuilder(targetBuilder); UriComponents result = targetBuilder.build().encode(); assertEquals("/foo/bar/ba%2Fz", result.getPath()); assertEquals(Arrays.asList("foo", "bar", "ba%2Fz"), result.getPathSegments()); }
/** * Set or append individual URI components of this builder from the values * of the given {@link UriComponents} instance. * <p>For the semantics of each component (i.e. set vs append) check the * builder methods on this class. For example {@link #host(String)} sets * while {@link #path(String)} appends. * @param uriComponents the UriComponents to copy from * @return this UriComponentsBuilder */ public UriComponentsBuilder uriComponents(UriComponents uriComponents) { Assert.notNull(uriComponents, "UriComponents must not be null"); uriComponents.copyToUriComponentsBuilder(this); return this; }
/** * Set or append individual URI components of this builder from the values * of the given {@link UriComponents} instance. * <p>For the semantics of each component (i.e. set vs append) check the * builder methods on this class. For example {@link #host(String)} sets * while {@link #path(String)} appends. * @param uriComponents the UriComponents to copy from * @return this UriComponentsBuilder */ public UriComponentsBuilder uriComponents(UriComponents uriComponents) { Assert.notNull(uriComponents, "UriComponents must not be null"); uriComponents.copyToUriComponentsBuilder(this); return this; }