src/main/java/de/qaware/xff/util/uri/UriComponentsBuilder.java
/**
     * Create a builder that is initialized with the given URI 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 uriString = &quot;/hotels/42?filter={value}&quot;;
     * UriComponentsBuilder.fromUriString(uriString).buildAndExpand(&quot;hot&amp;cold&quot;);
     * </pre>
     *
     * @param uri the URI string to initialize with
     * @return the new {@code UriComponentsBuilder}
     */
Create a builder that is initialized with the given URI 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. Such values should be substituted for URI
variables to enable correct parsing:

String uriString = "/hotels/42?filter={value}";
UriComponentsBuilder.fromUriString(uriString).buildAndExpand("hot&cold");


@param uri the URI string to initialize with
@return the new  UriComponentsBuilder
Create a builder that is initialized with the given URI 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 . Such values should be substituted for URI variables to enable correct parsing : String uriString = " / hotels / 42?filter = { value } " ; UriComponentsBuilder . fromUriString ( uriString ) . buildAndExpand ( " hot&cold " ) ; @param uri the URI string to initialize with @return the new UriComponentsBuilder
public static UriComponentsBuilder fromUriString(String uri) {
        Validate.notNull(uri, "URI must not be null");
        Matcher matcher = URI_PATTERN.matcher(uri);
        if (!matcher.matches()) {
            throw new IllegalArgumentException("[" + uri + "] is not a valid URI");
        }
        UriComponentsBuilder builder = new UriComponentsBuilder();
        String scheme = matcher.group(URI_PATTERN_SCHEME_INDEX);
        String userInfo = matcher.group(URI_PATTERN_USER_INFO_INDEX);
        String host = matcher.group(URI_PATTERN_HOST_INDEX);
        String port = matcher.group(URI_PATTERN_PORT_INDEX);
        String path = matcher.group(URI_PATTERN_PATH_INDEX);
        String query = matcher.group(URI_PATTERN_QUERY_INDEX);
        String fragment = matcher.group(URI_PATTERN_FRAGMENT_INDEX);
        builder.scheme(scheme);
        if (isOpaque(uri, scheme)) {
            setSchemeSpecificPart(uri, builder, scheme, fragment);
        } else {
            builder.userInfo(userInfo);
            builder.host(host);
            if (StringUtils.isNotEmpty(port)) {
                builder.port(port);
            }
            builder.path(path);
            builder.query(query);
        }
        if (isNotBlank(fragment)) {
            builder.fragment(fragment);
        }
        return builder;
    }
public static UriComponentsBuilder fromUriString ( String uri ) { Validate . notNull ( uri , "URI must not be null" ) ; Matcher matcher = URI_PATTERN . matcher ( uri ) ; if ( ! matcher . matches ( ) ) { throw new IllegalArgumentException ( "[" + uri + "] is not a valid URI" ) ; } UriComponentsBuilder builder = new UriComponentsBuilder ( ) ; String scheme = matcher . group ( URI_PATTERN_SCHEME_INDEX ) ; String userInfo = matcher . group ( URI_PATTERN_USER_INFO_INDEX ) ; String host = matcher . group ( URI_PATTERN_HOST_INDEX ) ; String port = matcher . group ( URI_PATTERN_PORT_INDEX ) ; String path = matcher . group ( URI_PATTERN_PATH_INDEX ) ; String query = matcher . group ( URI_PATTERN_QUERY_INDEX ) ; String fragment = matcher . group ( URI_PATTERN_FRAGMENT_INDEX ) ; builder . scheme ( scheme ) ; if ( isOpaque ( uri , scheme ) ) { setSchemeSpecificPart ( uri , builder , scheme , fragment ) ; } else { builder . userInfo ( userInfo ) ; builder . host ( host ) ; if ( StringUtils . isNotEmpty ( port ) ) { builder . port ( port ) ; } builder . path ( path ) ; builder . query ( query ) ; } if ( isNotBlank ( fragment ) ) { builder . fragment ( fragment ) ; } return builder ; }
Create a builder that is initialized with the given URI string.
Create a builder that is initialized with the given URI string .