summaryrefslogtreecommitdiffstats
path: root/container-core/src/main/java/com/yahoo/restapi/RestApiImpl.java
diff options
context:
space:
mode:
Diffstat (limited to 'container-core/src/main/java/com/yahoo/restapi/RestApiImpl.java')
-rw-r--r--container-core/src/main/java/com/yahoo/restapi/RestApiImpl.java13
1 files changed, 9 insertions, 4 deletions
diff --git a/container-core/src/main/java/com/yahoo/restapi/RestApiImpl.java b/container-core/src/main/java/com/yahoo/restapi/RestApiImpl.java
index cc243a3e92b..1bde8d635a5 100644
--- a/container-core/src/main/java/com/yahoo/restapi/RestApiImpl.java
+++ b/container-core/src/main/java/com/yahoo/restapi/RestApiImpl.java
@@ -1,6 +1,8 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.restapi;
+import ai.vespa.http.HttpURL;
+import ai.vespa.http.HttpURL.Query;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yahoo.container.jdisc.AclMapping;
import com.yahoo.container.jdisc.HttpRequest;
@@ -398,7 +400,7 @@ class RestApiImpl implements RestApi {
return requestContent().orElseThrow(() -> new RestApiException.BadRequest("Request content missing"));
}
@Override public ObjectMapper jacksonJsonMapper() { return jacksonJsonMapper; }
- @Override public UriBuilder uriBuilder() {
+ @Override public HttpURL baseRequestURL() {
URI uri = request.getUri();
// Reconstruct the URI used by the client to access the API.
// This is needed for producing URIs in the response that links to other parts of the Rest API.
@@ -408,7 +410,7 @@ class RestApiImpl implements RestApi {
if (hostHeader == null || hostHeader.isBlank()) {
hostHeader = request.getHeader("Host");
}
- if (hostHeader != null && !hostHeader.isBlank()) {
+ if (hostHeader != null && ! hostHeader.isBlank()) {
sb.append(hostHeader);
} else {
sb.append(uri.getHost());
@@ -416,7 +418,7 @@ class RestApiImpl implements RestApi {
sb.append(":").append(uri.getPort());
}
}
- return new UriBuilder(sb.toString());
+ return HttpURL.from(URI.create(sb.toString()));
}
@Override public AclMapping.Action aclAction() { return aclAction; }
@Override public Optional<Principal> userPrincipal() {
@@ -435,10 +437,12 @@ class RestApiImpl implements RestApi {
return getString(name)
.orElseThrow(() -> new RestApiException.BadRequest("Path parameter '" + name + "' is missing"));
}
+ @Override public HttpURL.Path getFullPath() {
+ return pathMatcher.getPath();
+ }
@Override public Optional<HttpURL.Path> getRest() {
return Optional.ofNullable(pathMatcher.getRest());
}
-
}
private class QueryParametersImpl implements RestApi.RequestContext.QueryParameters {
@@ -452,6 +456,7 @@ class RestApiImpl implements RestApi {
if (result == null) return List.of();
return List.copyOf(result);
}
+ @Override public HttpURL.Query getFullQuery() { return Query.empty().add(request.getJDiscRequest().parameters()); }
}
private class HeadersImpl implements RestApi.RequestContext.Headers {