summaryrefslogtreecommitdiffstats
path: root/container-core/src/main/java/com/yahoo
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@verizonmedia.com>2021-03-26 14:26:20 +0100
committerBjørn Christian Seime <bjorncs@verizonmedia.com>2021-03-26 14:26:20 +0100
commit75fce53e614d1f30276c23ab0601a43337fb7f95 (patch)
treea1b4057d1297dee013a80c78edd55d7af2687697 /container-core/src/main/java/com/yahoo
parent5c080930cfa4ecac4357dc977c86f2ced9db6477 (diff)
Rename class 'Uri' to 'UriBuilder'
Diffstat (limited to 'container-core/src/main/java/com/yahoo')
-rw-r--r--container-core/src/main/java/com/yahoo/restapi/ResourceResponse.java2
-rw-r--r--container-core/src/main/java/com/yahoo/restapi/UriBuilder.java (renamed from container-core/src/main/java/com/yahoo/restapi/Uri.java)24
2 files changed, 13 insertions, 13 deletions
diff --git a/container-core/src/main/java/com/yahoo/restapi/ResourceResponse.java b/container-core/src/main/java/com/yahoo/restapi/ResourceResponse.java
index 0188136addb..ce8c718fc74 100644
--- a/container-core/src/main/java/com/yahoo/restapi/ResourceResponse.java
+++ b/container-core/src/main/java/com/yahoo/restapi/ResourceResponse.java
@@ -31,7 +31,7 @@ public class ResourceResponse extends SlimeJsonResponse {
var resourceArray = slime.setObject().setArray("resources");
for (var subResource : subResources) {
var resourceEntry = resourceArray.addObject();
- resourceEntry.setString("url", new Uri(parentUrl).append(subResource)
+ resourceEntry.setString("url", new UriBuilder(parentUrl).append(subResource)
.withTrailingSlash()
.toString());
}
diff --git a/container-core/src/main/java/com/yahoo/restapi/Uri.java b/container-core/src/main/java/com/yahoo/restapi/UriBuilder.java
index c1b0d19eb3e..daebb147547 100644
--- a/container-core/src/main/java/com/yahoo/restapi/Uri.java
+++ b/container-core/src/main/java/com/yahoo/restapi/UriBuilder.java
@@ -10,16 +10,16 @@ import java.net.URISyntaxException;
*
* @author bratseth
*/
-public class Uri {
+public class UriBuilder {
/** The URI instance wrapped by this */
private final URI uri;
- public Uri(URI uri) {
+ public UriBuilder(URI uri) {
this.uri = uri;
}
- public Uri(String uri) {
+ public UriBuilder(String uri) {
try {
this.uri = new URI(uri);
}
@@ -29,21 +29,21 @@ public class Uri {
}
/** Returns a uri with the given path appended and all parameters removed */
- public Uri append(String pathElement) {
- return new Uri(withoutParameters().withTrailingSlash() + pathElement);
+ public UriBuilder append(String pathElement) {
+ return new UriBuilder(withoutParameters().withTrailingSlash() + pathElement);
}
- public Uri withoutParameters() {
+ public UriBuilder withoutParameters() {
int parameterStart = uri.toString().indexOf("?");
if (parameterStart < 0)
- return new Uri(uri.toString());
+ return new UriBuilder(uri.toString());
else
- return new Uri(uri.toString().substring(0, parameterStart));
+ return new UriBuilder(uri.toString().substring(0, parameterStart));
}
- public Uri withPath(String path) {
+ public UriBuilder withPath(String path) {
try {
- return new Uri(new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(),
+ return new UriBuilder(new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(),
uri.getPort(), path, uri.getQuery(), uri.getFragment()));
}
catch (URISyntaxException e) {
@@ -51,9 +51,9 @@ public class Uri {
}
}
- public Uri withTrailingSlash() {
+ public UriBuilder withTrailingSlash() {
if (toString().endsWith("/")) return this;
- return new Uri(toString() + "/");
+ return new UriBuilder(toString() + "/");
}
public URI toURI() { return uri; }