/** * Removes any URI query from the given uri and return a new URI that does not contain the query portion. * * @param uri The URI whose query value is to be removed. * @return a new URI that does not contain a query value. * @throws java.net.URISyntaxException */ public static URI removeQuery(URI uri) throws URISyntaxException { return createURIWithQuery(uri, null); }
/** * Creates a URI from the original URI and the remaining parameters. * * When the query options of a URI are applied to certain objects the used portion of the query options needs * to be removed and replaced with those that remain so that other parts of the code can attempt to apply the * remainder or give an error is unknown values were given. This method is used to update a URI with those * remainder values. * * @param originalURI The URI whose current parameters are remove and replaced with the given remainder value. * @param params The URI params that should be used to replace the current ones in the target. * @return a new URI that matches the original one but has its query options replaced with the given ones. * @throws java.net.URISyntaxException */ public static URI createRemainingURI(URI originalURI, Map<String, String> params) throws URISyntaxException { String s = createQueryString(params); if (s.length() == 0) { s = null; } return createURIWithQuery(originalURI, s); }
/** * Given a Key / Value mapping create and append a URI query value that represents the mapped entries, return the * newly updated URI that contains the value of the given URI and the appended query value. Each entry in the query * string is prefixed by the supplied optionPrefix string. * * @param uri The source URI that will have the Map entries appended as a URI query value. * @param queryParameters The Key / Value mapping that will be transformed into a URI query string. * @param optionPrefix A string value that when not null or empty is used to prefix each query option key. * @return A new URI value that combines the given URI and the constructed query string. * @throws java.net.URISyntaxException */ public static URI applyParameters(URI uri, Map<String, String> queryParameters, String optionPrefix) throws URISyntaxException { if (queryParameters != null && !queryParameters.isEmpty()) { StringBuilder newQuery = uri.getRawQuery() != null ? new StringBuilder(uri.getRawQuery()) : new StringBuilder(); for (Map.Entry<String, String> param : queryParameters.entrySet()) { if (param.getKey().startsWith(optionPrefix)) { if (newQuery.length() != 0) { newQuery.append('&'); } final String key = param.getKey().substring(optionPrefix.length()); newQuery.append(key).append('=').append(param.getValue()); } } uri = createURIWithQuery(uri, newQuery.toString()); } return uri; }
/** * Removes any URI query from the given uri and return a new URI that does not contain the query portion. * * @param uri The URI whose query value is to be removed. * @return a new URI that does not contain a query value. * @throws java.net.URISyntaxException */ public static URI removeQuery(URI uri) throws URISyntaxException { return createURIWithQuery(uri, null); }
/** * Removes any URI query from the given uri and return a new URI that does not contain the query portion. * * @param uri The URI whose query value is to be removed. * @return a new URI that does not contain a query value. * @throws java.net.URISyntaxException */ public static URI removeQuery(URI uri) throws URISyntaxException { return createURIWithQuery(uri, null); }
/** * Removes any URI query from the given uri and return a new URI that does not contain the query portion. * * @param uri The URI whose query value is to be removed. * @return a new URI that does not contain a query value. * @throws java.net.URISyntaxException */ public static URI removeQuery(URI uri) throws URISyntaxException { return createURIWithQuery(uri, null); }
/** * Removes any URI query from the given uri and return a new URI that does not contain the query portion. * * @param uri The URI whose query value is to be removed. * @return a new URI that does not contain a query value. * @throws java.net.URISyntaxException */ public static URI removeQuery(URI uri) throws URISyntaxException { return createURIWithQuery(uri, null); }
/** * Removes any URI query from the given uri and return a new URI that does not contain the query portion. * * @param uri The URI whose query value is to be removed. * @return a new URI that does not contain a query value. * @throws java.net.URISyntaxException */ public static URI removeQuery(URI uri) throws URISyntaxException { return createURIWithQuery(uri, null); }
/** * Removes any URI query from the given uri and return a new URI that does not contain the query portion. * * @param uri The URI whose query value is to be removed. * @return a new URI that does not contain a query value. * @throws java.net.URISyntaxException */ public static URI removeQuery(URI uri) throws URISyntaxException { return createURIWithQuery(uri, null); }
/** * Creates a URI from the original URI and the remaining parameters. * * When the query options of a URI are applied to certain objects the used portion of the query options needs * to be removed and replaced with those that remain so that other parts of the code can attempt to apply the * remainder or give an error is unknown values were given. This method is used to update a URI with those * remainder values. * * @param originalURI The URI whose current parameters are remove and replaced with the given remainder value. * @param params The URI params that should be used to replace the current ones in the target. * @return a new URI that matches the original one but has its query options replaced with the given ones. * @throws java.net.URISyntaxException */ public static URI createRemainingURI(URI originalURI, Map<String, String> params) throws URISyntaxException { String s = createQueryString(params); if (s.length() == 0) { s = null; } return createURIWithQuery(originalURI, s); }
/** * Creates a URI from the original URI and the remaining parameters. * * When the query options of a URI are applied to certain objects the used portion of the query options needs * to be removed and replaced with those that remain so that other parts of the code can attempt to apply the * remainder or give an error is unknown values were given. This method is used to update a URI with those * remainder values. * * @param originalURI The URI whose current parameters are remove and replaced with the given remainder value. * @param params The URI params that should be used to replace the current ones in the target. * @return a new URI that matches the original one but has its query options replaced with the given ones. * @throws java.net.URISyntaxException */ public static URI createRemainingURI(URI originalURI, Map<String, String> params) throws URISyntaxException { String s = createQueryString(params); if (s.length() == 0) { s = null; } return createURIWithQuery(originalURI, s); }
/** * Creates a URI from the original URI and the remaining parameters. * * When the query options of a URI are applied to certain objects the used portion of the query options needs * to be removed and replaced with those that remain so that other parts of the code can attempt to apply the * remainder or give an error is unknown values were given. This method is used to update a URI with those * remainder values. * * @param originalURI The URI whose current parameters are remove and replaced with the given remainder value. * @param params The URI params that should be used to replace the current ones in the target. * @return a new URI that matches the original one but has its query options replaced with the given ones. * @throws java.net.URISyntaxException */ public static URI createRemainingURI(URI originalURI, Map<String, String> params) throws URISyntaxException { String s = createQueryString(params); if (s.length() == 0) { s = null; } return createURIWithQuery(originalURI, s); }
/** * Creates a URI from the original URI and the remaining parameters. * * When the query options of a URI are applied to certain objects the used portion of the query options needs * to be removed and replaced with those that remain so that other parts of the code can attempt to apply the * remainder or give an error is unknown values were given. This method is used to update a URI with those * remainder values. * * @param originalURI The URI whose current parameters are remove and replaced with the given remainder value. * @param params The URI params that should be used to replace the current ones in the target. * @return a new URI that matches the original one but has its query options replaced with the given ones. * @throws java.net.URISyntaxException */ public static URI createRemainingURI(URI originalURI, Map<String, String> params) throws URISyntaxException { String s = createQueryString(params); if (s.length() == 0) { s = null; } return createURIWithQuery(originalURI, s); }
/** * Creates a URI from the original URI and the remaining parameters. * * When the query options of a URI are applied to certain objects the used portion of the query options needs * to be removed and replaced with those that remain so that other parts of the code can attempt to apply the * remainder or give an error is unknown values were given. This method is used to update a URI with those * remainder values. * * @param originalURI The URI whose current parameters are remove and replaced with the given remainder value. * @param params The URI params that should be used to replace the current ones in the target. * @return a new URI that matches the original one but has its query options replaced with the given ones. * @throws java.net.URISyntaxException */ public static URI createRemainingURI(URI originalURI, Map<String, String> params) throws URISyntaxException { String s = createQueryString(params); if (s.length() == 0) { s = null; } return createURIWithQuery(originalURI, s); }
/** * Given a Key / Value mapping create and append a URI query value that represents the mapped entries, return the * newly updated URI that contains the value of the given URI and the appended query value. Each entry in the query * string is prefixed by the supplied optionPrefix string. * * @param uri The source URI that will have the Map entries appended as a URI query value. * @param queryParameters The Key / Value mapping that will be transformed into a URI query string. * @param optionPrefix A string value that when not null or empty is used to prefix each query option key. * @return A new URI value that combines the given URI and the constructed query string. * @throws java.net.URISyntaxException */ public static URI applyParameters(URI uri, Map<String, String> queryParameters, String optionPrefix) throws URISyntaxException { if (queryParameters != null && !queryParameters.isEmpty()) { StringBuilder newQuery = uri.getRawQuery() != null ? new StringBuilder(uri.getRawQuery()) : new StringBuilder(); for (Map.Entry<String, String> param : queryParameters.entrySet()) { if (param.getKey().startsWith(optionPrefix)) { if (newQuery.length() != 0) { newQuery.append('&'); } final String key = param.getKey().substring(optionPrefix.length()); newQuery.append(key).append('=').append(param.getValue()); } } uri = createURIWithQuery(uri, newQuery.toString()); } return uri; }
/** * Given a Key / Value mapping create and append a URI query value that represents the mapped entries, return the * newly updated URI that contains the value of the given URI and the appended query value. Each entry in the query * string is prefixed by the supplied optionPrefix string. * * @param uri The source URI that will have the Map entries appended as a URI query value. * @param queryParameters The Key / Value mapping that will be transformed into a URI query string. * @param optionPrefix A string value that when not null or empty is used to prefix each query option key. * @return A new URI value that combines the given URI and the constructed query string. * @throws java.net.URISyntaxException */ public static URI applyParameters(URI uri, Map<String, String> queryParameters, String optionPrefix) throws URISyntaxException { if (queryParameters != null && !queryParameters.isEmpty()) { StringBuilder newQuery = uri.getRawQuery() != null ? new StringBuilder(uri.getRawQuery()) : new StringBuilder(); for (Map.Entry<String, String> param : queryParameters.entrySet()) { if (param.getKey().startsWith(optionPrefix)) { if (newQuery.length() != 0) { newQuery.append('&'); } final String key = param.getKey().substring(optionPrefix.length()); newQuery.append(key).append('=').append(param.getValue()); } } uri = createURIWithQuery(uri, newQuery.toString()); } return uri; }
/** * Creates a URI from the original URI and the remaining parameters. * * When the query options of a URI are applied to certain objects the used portion of the query options needs * to be removed and replaced with those that remain so that other parts of the code can attempt to apply the * remainder or give an error is unknown values were given. This method is used to update a URI with those * remainder values. * * @param originalURI The URI whose current parameters are remove and replaced with the given remainder value. * @param params The URI params that should be used to replace the current ones in the target. * @return a new URI that matches the original one but has its query options replaced with the given ones. * @throws java.net.URISyntaxException */ public static URI createRemainingURI(URI originalURI, Map<String, String> params) throws URISyntaxException { String s = createQueryString(params); if (s.length() == 0) { s = null; } return createURIWithQuery(originalURI, s); }
/** * Given a Key / Value mapping create and append a URI query value that represents the mapped entries, return the * newly updated URI that contains the value of the given URI and the appended query value. Each entry in the query * string is prefixed by the supplied optionPrefix string. * * @param uri The source URI that will have the Map entries appended as a URI query value. * @param queryParameters The Key / Value mapping that will be transformed into a URI query string. * @param optionPrefix A string value that when not null or empty is used to prefix each query option key. * @return A new URI value that combines the given URI and the constructed query string. * @throws java.net.URISyntaxException */ public static URI applyParameters(URI uri, Map<String, String> queryParameters, String optionPrefix) throws URISyntaxException { if (queryParameters != null && !queryParameters.isEmpty()) { StringBuilder newQuery = uri.getRawQuery() != null ? new StringBuilder(uri.getRawQuery()) : new StringBuilder(); for (Map.Entry<String, String> param : queryParameters.entrySet()) { if (param.getKey().startsWith(optionPrefix)) { if (newQuery.length() != 0) { newQuery.append('&'); } final String key = param.getKey().substring(optionPrefix.length()); newQuery.append(key).append('=').append(param.getValue()); } } uri = createURIWithQuery(uri, newQuery.toString()); } return uri; }
/** * Given a Key / Value mapping create and append a URI query value that represents the mapped entries, return the * newly updated URI that contains the value of the given URI and the appended query value. Each entry in the query * string is prefixed by the supplied optionPrefix string. * * @param uri The source URI that will have the Map entries appended as a URI query value. * @param queryParameters The Key / Value mapping that will be transformed into a URI query string. * @param optionPrefix A string value that when not null or empty is used to prefix each query option key. * @return A new URI value that combines the given URI and the constructed query string. * @throws java.net.URISyntaxException */ public static URI applyParameters(URI uri, Map<String, String> queryParameters, String optionPrefix) throws URISyntaxException { if (queryParameters != null && !queryParameters.isEmpty()) { StringBuilder newQuery = uri.getRawQuery() != null ? new StringBuilder(uri.getRawQuery()) : new StringBuilder(); for (Map.Entry<String, String> param : queryParameters.entrySet()) { if (param.getKey().startsWith(optionPrefix)) { if (newQuery.length() != 0) { newQuery.append('&'); } final String key = param.getKey().substring(optionPrefix.length()); newQuery.append(key).append('=').append(param.getValue()); } } uri = createURIWithQuery(uri, newQuery.toString()); } return uri; }
/** * Given a Key / Value mapping create and append a URI query value that represents the mapped entries, return the * newly updated URI that contains the value of the given URI and the appended query value. Each entry in the query * string is prefixed by the supplied optionPrefix string. * * @param uri The source URI that will have the Map entries appended as a URI query value. * @param queryParameters The Key / Value mapping that will be transformed into a URI query string. * @param optionPrefix A string value that when not null or empty is used to prefix each query option key. * @return A new URI value that combines the given URI and the constructed query string. * @throws java.net.URISyntaxException */ public static URI applyParameters(URI uri, Map<String, String> queryParameters, String optionPrefix) throws URISyntaxException { if (queryParameters != null && !queryParameters.isEmpty()) { StringBuilder newQuery = uri.getRawQuery() != null ? new StringBuilder(uri.getRawQuery()) : new StringBuilder(); for (Map.Entry<String, String> param : queryParameters.entrySet()) { if (param.getKey().startsWith(optionPrefix)) { if (newQuery.length() != 0) { newQuery.append('&'); } final String key = param.getKey().substring(optionPrefix.length()); newQuery.append(key).append('=').append(param.getValue()); } } uri = createURIWithQuery(uri, newQuery.toString()); } return uri; }