private UriBuilder(URI uri) { checkNotNull(uri, "uri"); this.scheme = uri.getScheme(); this.host = uri.getHost(); this.port = uri.getPort() == -1 ? null : uri.getPort(); if (uri.getPath() != null) path(unescapeSpecialChars(uri.getPath())); if (uri.getQuery() != null) query(queryParser().apply(unescapeSpecialChars(uri.getQuery()))); }
private UriBuilder(URI uri) { checkNotNull(uri, "uri"); this.scheme = uri.getScheme(); this.host = uri.getHost(); this.port = uri.getPort() == -1 ? null : uri.getPort(); if (uri.getPath() != null) path(unescapeSpecialChars(uri.getPath())); if (uri.getQuery() != null) query(queryParser().apply(unescapeSpecialChars(uri.getQuery()))); }
private UriBuilder(URI uri) { checkNotNull(uri, "uri"); this.scheme = uri.getScheme(); this.host = uri.getHost(); this.port = uri.getPort() == -1 ? null : uri.getPort(); if (uri.getRawPath() != null) // path decodes the string, so we need to get at the raw (encoded) string path(unescapeSpecialChars(uri.getRawPath())); if (uri.getRawQuery() != null) // The query parser decodes the strings that are passed to it; we should pass raw (encoded) queries query(queryParser().apply(unescapeSpecialChars(uri.getRawQuery()))); }
@Test(dataProvider = "strings") public void testPath(String path) { assertEquals(uriBuilder("https://foo.com:8080").path(path).toString(), "https://foo.com:8080/" + path); assertEquals(uriBuilder("https://foo.com:8080").path(path).build().toString(), "https://foo.com:8080/" + urlEncode(path, '/', ':', ';', '=')); assertEquals(uriBuilder("https://api.github.com/repos/user?foo=bar&kung=fu").path(path).toString(), "https://api.github.com/" + path + "?foo=bar&kung=fu"); assertEquals(uriBuilder("https://api.github.com/repos/user?foo=bar&kung=fu").path(path).build().toString(), "https://api.github.com/" + urlEncode(path, '/', ':', ';', '=') + "?foo=bar&kung=fu"); assertEquals(uriBuilder("https://api.github.com/repos/{user}").path(path).toString(), "https://api.github.com/" + path); assertEquals(uriBuilder("https://api.github.com/repos/{user}").path(path).build(templateParams).toASCIIString(), "https://api.github.com/" + urlEncode(path, '/', ':', ';', '=')); }
@Test(dataProvider = "strings") public void testPath(String path) { assertEquals(uriBuilder("https://foo.com:8080").path(path).toString(), "https://foo.com:8080/" + path); assertEquals(uriBuilder("https://foo.com:8080").path(path).build().toString(), "https://foo.com:8080/" + urlEncode(path, '/', ':', ';', '=')); assertEquals(uriBuilder("https://api.github.com/repos/user?foo=bar&kung=fu").path(path).toString(), "https://api.github.com/" + path + "?foo=bar&kung=fu"); assertEquals(uriBuilder("https://api.github.com/repos/user?foo=bar&kung=fu").path(path).build().toString(), "https://api.github.com/" + urlEncode(path, '/', ':', ';', '=') + "?foo=bar&kung=fu"); assertEquals(uriBuilder("https://api.github.com/repos/{user}").path(path).toString(), "https://api.github.com/" + path); assertEquals(uriBuilder("https://api.github.com/repos/{user}").path(path).build(templateParams).toASCIIString(), "https://api.github.com/" + urlEncode(path, '/', ':', ';', '=')); }
private UriBuilder(URI uri) { checkNotNull(uri, "uri"); this.scheme = uri.getScheme(); this.host = uri.getHost(); this.port = uri.getPort() == -1 ? null : uri.getPort(); if (uri.getRawPath() != null) // path decodes the string, so we need to get at the raw (encoded) string path(unescapeSpecialChars(uri.getRawPath())); if (uri.getRawQuery() != null) // The query parser decodes the strings that are passed to it; we should pass raw (encoded) queries query(queryParser().apply(unescapeSpecialChars(uri.getRawQuery()))); }
/** * @see HttpRequest#getEndpoint() */ public T replacePath(String path) { checkNotNull(endpoint, "endpoint"); checkNotNull(path, "path"); endpoint = uriBuilder(endpoint).path(path).build(); return self(); }
/** * @see HttpRequest#getEndpoint() */ public T replacePath(String path) { checkNotNull(endpoint, "endpoint"); checkNotNull(path, "path"); endpoint = uriBuilder(endpoint).path(path).build(); return self(); }
private UriBuilder(URI uri) { checkNotNull(uri, "uri"); this.scheme = uri.getScheme(); this.host = uri.getHost(); this.port = uri.getPort() == -1 ? null : uri.getPort(); if (uri.getRawPath() != null) // path decodes the string, so we need to get at the raw (encoded) string path(unescapeSpecialChars(uri.getRawPath())); if (uri.getRawQuery() != null) // The query parser decodes the strings that are passed to it; we should pass raw (encoded) queries query(queryParser().apply(unescapeSpecialChars(uri.getRawQuery()))); }
/** * @see HttpRequest#getEndpoint() */ public T replacePath(String path) { checkNotNull(endpoint, "endpoint"); checkNotNull(path, "path"); endpoint = uriBuilder(endpoint).path(path).build(); return self(); }
private UriBuilder(URI uri) { checkNotNull(uri, "uri"); this.scheme = uri.getScheme(); this.host = uri.getHost(); this.port = uri.getPort() == -1 ? null : uri.getPort(); if (uri.getPath() != null) path(unescapeSpecialChars(uri.getPath())); if (uri.getQuery() != null) query(queryParser().apply(unescapeSpecialChars(uri.getQuery()))); }
/** * @see HttpRequest#getEndpoint() */ public T replacePath(String path) { checkNotNull(endpoint, "endpoint"); checkNotNull(path, "path"); endpoint = uriBuilder(endpoint).path(path).build(); return self(); }
/** * @see HttpRequest#getEndpoint() */ public T replacePath(String path) { checkNotNull(endpoint, "endpoint"); checkNotNull(path, "path"); endpoint = uriBuilder(endpoint).path(path).build(); return self(); }
/** * @see HttpRequest#getEndpoint() */ public T replacePath(String path) { checkNotNull(endpoint, "endpoint"); checkNotNull(path, "path"); endpoint = uriBuilder(endpoint).path(path).build(); return self(); }