src/main/java/de/qaware/xff/util/uri/UriComponentsBuilder.java
/**
     * Create a URI components builder from the given HTTP URL String.
     * <p><strong>Note:</strong> The presence of reserved characters can prevent
     * correct parsing of the URI string. For example if a query parameter
     * contains {@code '='} or {@code '&'} characters, the query string cannot
     * be parsed unambiguously. Such values should be substituted for URI
     * variables to enable correct parsing:
     * <pre class="code">
     * String urlString = &quot;https://example.com/hotels/42?filter={value}&quot;;
     * UriComponentsBuilder.fromHttpUrl(urlString).buildAndExpand(&quot;hot&amp;cold&quot;);
     * </pre>
     *
     * @param httpUrl the source URI
     * @return the URI components of the URI
     */
Create a URI components builder from the given HTTP URL String.
Note: The presence of reserved characters can prevent
correct parsing of the URI string. For example if a query parameter
contains  '=' or  '&' characters, the query string cannot
be parsed unambiguously.

@param httpUrl the source URI
@return the URI components of the URI
Create a URI components builder from the given HTTP URL String . Note : The presence of reserved characters can prevent correct parsing of the URI string . For example if a query parameter contains ' = ' or ' & ' characters the query string cannot be parsed unambiguously . @param httpUrl the source URI @return the URI components of the URI
public static UriComponentsBuilder fromHttpUrl(String httpUrl) {
        Validate.notNull(httpUrl, "HTTP URL must not be null");
        Matcher matcher = HTTP_URL_PATTERN.matcher(httpUrl);
        if (matcher.matches()) {
            UriComponentsBuilder builder = new UriComponentsBuilder();
            String scheme = matcher.group(HTTP_URL_PATTERN_SCHEME_INDEX);
            builder.scheme(scheme != null ? scheme.toLowerCase(Locale.ENGLISH) : null);
            builder.userInfo(matcher.group(HTTP_URL_PATTERN_USER_INFO_INDEX));
            String host = matcher.group(HTTP_URL_PATTERN_HOST_INDEX);
            if (StringUtils.isNotEmpty(scheme) && StringUtils.isEmpty(host)) {
                throw new IllegalArgumentException("[" + httpUrl + "] is not a valid HTTP URL");
            }
            builder.host(host);
            String port = matcher.group(HTTP_URL_PATTERN_PORT_INDEX);
            if (StringUtils.isNotEmpty(port)) {
                builder.port(port);
            }
            builder.path(matcher.group(HTTP_URL_PATTERN_PATH_INDEX));
            builder.query(matcher.group(HTTP_URL_PATTERN_QUERY_INDEX));
            return builder;
        } else {
            throw new IllegalArgumentException("[" + httpUrl + "] is not a valid HTTP URL");
        }
    }
public static UriComponentsBuilder fromHttpUrl ( String httpUrl ) { Validate . notNull ( httpUrl , "HTTP URL must not be null" ) ; Matcher matcher = HTTP_URL_PATTERN . matcher ( httpUrl ) ; if ( matcher . matches ( ) ) { UriComponentsBuilder builder = new UriComponentsBuilder ( ) ; String scheme = matcher . group ( HTTP_URL_PATTERN_SCHEME_INDEX ) ; builder . scheme ( scheme != null ? scheme . toLowerCase ( Locale . ENGLISH ) : null ) ; builder . userInfo ( matcher . group ( HTTP_URL_PATTERN_USER_INFO_INDEX ) ) ; String host = matcher . group ( HTTP_URL_PATTERN_HOST_INDEX ) ; if ( StringUtils . isNotEmpty ( scheme ) && StringUtils . isEmpty ( host ) ) { throw new IllegalArgumentException ( "[" + httpUrl + "] is not a valid HTTP URL" ) ; } builder . host ( host ) ; String port = matcher . group ( HTTP_URL_PATTERN_PORT_INDEX ) ; if ( StringUtils . isNotEmpty ( port ) ) { builder . port ( port ) ; } builder . path ( matcher . group ( HTTP_URL_PATTERN_PATH_INDEX ) ) ; builder . query ( matcher . group ( HTTP_URL_PATTERN_QUERY_INDEX ) ) ; return builder ; } else { throw new IllegalArgumentException ( "[" + httpUrl + "] is not a valid HTTP URL" ) ; } }
Create a URI components builder from the given HTTP URL String.
Create a URI components builder from the given HTTP URL String .