/** * Create a new, empty builder. * @return the new {@code UriComponentsBuilder} */ public static UriComponentsBuilder newInstance() { return new UriComponentsBuilder(); }
/** * Clone this {@code UriComponentsBuilder}. * @return the cloned {@code UriComponentsBuilder} object * @since 4.2.7 */ public UriComponentsBuilder cloneBuilder() { return new UriComponentsBuilder(this); }
/** * Clone this {@code UriComponentsBuilder}. * @return the cloned {@code UriComponentsBuilder} object * @since 4.2.7 */ public UriComponentsBuilder cloneBuilder() { return new UriComponentsBuilder(this); }
/** * Create a new, empty builder. * @return the new {@code UriComponentsBuilder} */ public static UriComponentsBuilder newInstance() { return new UriComponentsBuilder(); }
/** * Create a builder that is initialized with the given path. * @param path the path to initialize with * @return the new {@code UriComponentsBuilder} */ public static UriComponentsBuilder fromPath(String path) { UriComponentsBuilder builder = new UriComponentsBuilder(); builder.path(path); return builder; }
/** * Create a builder that is initialized with the given {@code URI}. * @param uri the URI to initialize with * @return the new {@code UriComponentsBuilder} */ public static UriComponentsBuilder fromUri(URI uri) { UriComponentsBuilder builder = new UriComponentsBuilder(); builder.uri(uri); return builder; }
/** * Create a builder that is initialized with the given path. * @param path the path to initialize with * @return the new {@code UriComponentsBuilder} */ public static UriComponentsBuilder fromPath(String path) { UriComponentsBuilder builder = new UriComponentsBuilder(); builder.path(path); return builder; }
/** * Create a builder that is initialized with the given {@code URI}. * @param uri the URI to initialize with * @return the new {@code UriComponentsBuilder} */ public static UriComponentsBuilder fromUri(URI uri) { UriComponentsBuilder builder = new UriComponentsBuilder(); builder.uri(uri); return builder; }
/** * Create an instance by parsing the "Origin" header of an HTTP request. * @see <a href="https://tools.ietf.org/html/rfc6454">RFC 6454</a> */ public static UriComponentsBuilder fromOriginHeader(String origin) { Matcher matcher = URI_PATTERN.matcher(origin); if (matcher.matches()) { UriComponentsBuilder builder = new UriComponentsBuilder(); String scheme = matcher.group(2); String host = matcher.group(6); String port = matcher.group(8); if (StringUtils.hasLength(scheme)) { builder.scheme(scheme); } builder.host(host); if (StringUtils.hasLength(port)) { builder.port(port); } return builder; } else { throw new IllegalArgumentException("[" + origin + "] is not a valid \"Origin\" header value"); } }
Matcher matcher = HTTP_URL_PATTERN.matcher(httpUrl); if (matcher.matches()) { UriComponentsBuilder builder = new UriComponentsBuilder(); String scheme = matcher.group(1); builder.scheme(scheme != null ? scheme.toLowerCase() : null);
Matcher matcher = URI_PATTERN.matcher(uri); if (matcher.matches()) { UriComponentsBuilder builder = new UriComponentsBuilder(); String scheme = matcher.group(2); String userInfo = matcher.group(5);
/** * Create an instance by parsing the "Origin" header of an HTTP request. * @see <a href="https://tools.ietf.org/html/rfc6454">RFC 6454</a> */ public static UriComponentsBuilder fromOriginHeader(String origin) { Matcher matcher = URI_PATTERN.matcher(origin); if (matcher.matches()) { UriComponentsBuilder builder = new UriComponentsBuilder(); String scheme = matcher.group(2); String host = matcher.group(6); String port = matcher.group(8); if (StringUtils.hasLength(scheme)) { builder.scheme(scheme); } builder.host(host); if (StringUtils.hasLength(port)) { builder.port(port); } return builder; } else { throw new IllegalArgumentException("[" + origin + "] is not a valid \"Origin\" header value"); } }
Matcher matcher = HTTP_URL_PATTERN.matcher(httpUrl); if (matcher.matches()) { UriComponentsBuilder builder = new UriComponentsBuilder(); String scheme = matcher.group(1); builder.scheme(scheme != null ? scheme.toLowerCase() : null);
Matcher matcher = URI_PATTERN.matcher(uri); if (matcher.matches()) { UriComponentsBuilder builder = new UriComponentsBuilder(); String scheme = matcher.group(2); String userInfo = matcher.group(5);
/** * Clone this {@code UriComponentsBuilder}. * @return the cloned {@code UriComponentsBuilder} object * @since 4.2.7 */ public UriComponentsBuilder cloneBuilder() { return new UriComponentsBuilder(this); }
/** * Create a new, empty builder. * @return the new {@code UriComponentsBuilder} */ public static UriComponentsBuilder newInstance() { return new UriComponentsBuilder(); }
/** * Returns a builder that is initialized with the given path. * * @param path the path to initialize with * @return the new {@code UriComponentsBuilder} */ public static UriComponentsBuilder fromPath(String path) { UriComponentsBuilder builder = new UriComponentsBuilder(); builder.path(path); return builder; }
/** * Returns a builder that is initialized with the given {@code URI}. * * @param uri the URI to initialize with * @return the new {@code UriComponentsBuilder} */ public static UriComponentsBuilder fromUri(URI uri) { UriComponentsBuilder builder = new UriComponentsBuilder(); builder.uri(uri); return builder; }
/** * Create a builder that is initialized with the given {@code URI}. * @param uri the URI to initialize with * @return the new {@code UriComponentsBuilder} */ public static UriComponentsBuilder fromUri(URI uri) { UriComponentsBuilder builder = new UriComponentsBuilder(); builder.uri(uri); return builder; }
/** * Create a builder that is initialized with the given {@code URI}. * @param uri the URI to initialize with * @return the new {@code UriComponentsBuilder} */ public static UriComponentsBuilder fromUri(URI uri) { UriComponentsBuilder builder = new UriComponentsBuilder(); builder.uri(uri); return builder; }