public static StringBuilder appendParameters(StringBuilder sb, Map<String, String> parameters) throws URISyntaxException { if (!parameters.isEmpty()) { sb.append('?'); sb.append(createQueryString(parameters)); } return sb; }
/** * 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); }
public static StringBuilder appendParameters(StringBuilder sb, Map<String, String> parameters) throws URISyntaxException { if (!parameters.isEmpty()) { sb.append('?'); sb.append(createQueryString(parameters)); } return sb; }
public static StringBuilder appendParameters(StringBuilder sb, Map<String, String> parameters) throws URISyntaxException { if (!parameters.isEmpty()) { sb.append('?'); sb.append(createQueryString(parameters)); } return sb; }
public static StringBuilder appendParameters(StringBuilder sb, Map<String, String> parameters) throws URISyntaxException { if (!parameters.isEmpty()) { sb.append('?'); sb.append(createQueryString(parameters)); } return sb; }
public static StringBuilder appendParameters(StringBuilder sb, Map<String, String> parameters) throws URISyntaxException { if (!parameters.isEmpty()) { sb.append('?'); sb.append(createQueryString(parameters)); } return sb; }
public static StringBuilder appendParameters(StringBuilder sb, Map<String, String> parameters) throws URISyntaxException { if (!parameters.isEmpty()) { sb.append('?'); sb.append(createQueryString(parameters)); } return sb; }
public static StringBuilder appendParameters(StringBuilder sb, Map<String, String> parameters) throws URISyntaxException { if (!parameters.isEmpty()) { sb.append('?'); sb.append(createQueryString(parameters)); } return sb; }
/** * 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); }
/** * 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); }
@Test public void testQueryConversion() throws Exception { Map<String, String> query = new HashMap<>(); String queryString = URISupport.createQueryString(query); System.out.println("queryString1: " + queryString); Assert.assertTrue(queryString.isEmpty()); query.put("key1", "value1"); queryString = URISupport.createQueryString(query); System.out.println("queryString2: " + queryString); Assert.assertEquals("key1=value1", queryString); query.put("key3", "value3"); queryString = URISupport.createQueryString(query); System.out.println("queryString3: " + queryString); Assert.assertEquals("key1=value1&key3=value3", queryString); query.put("key2", "value2"); queryString = URISupport.createQueryString(query); System.out.println("queryString4: " + queryString); Assert.assertEquals("key1=value1&key2=value2&key3=value3", queryString); }