From e49ff4621653db5f5aae496963c36d49b2c6f507 Mon Sep 17 00:00:00 2001 From: Bjørn Christian Seime Date: Fri, 16 Oct 2020 14:25:34 +0200 Subject: Temporarily setup old restapi handler w/o binding if new handler is enabled --- .../vespa/model/clients/ContainerDocumentApi.java | 26 +++++++++++++--------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'config-model') diff --git a/config-model/src/main/java/com/yahoo/vespa/model/clients/ContainerDocumentApi.java b/config-model/src/main/java/com/yahoo/vespa/model/clients/ContainerDocumentApi.java index bc2e5cc2b8a..45f6675838f 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/clients/ContainerDocumentApi.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/clients/ContainerDocumentApi.java @@ -41,16 +41,21 @@ public class ContainerDocumentApi { private static void addRestApiHandler(ContainerCluster cluster, Options options) { - String handlerClassName = options.useNewRestapiHandler - ? "com.yahoo.document.restapi.resource.DocumentV1ApiHandler" - : "com.yahoo.document.restapi.resource.RestApi"; - var handler = newVespaClientHandler(handlerClassName, "/document/v1/*", options); - cluster.addComponent(handler); - if (!options.useNewRestapiHandler) { - var executor = new Threadpool( - "restapi-handler", cluster, options.restApiThreadpoolOptions, options.feedThreadPoolSizeFactor); - handler.inject(executor); - handler.addComponent(executor); + // TODO(bjorncs,jvenstad) Cleanup once old restapi handler is gone + // We need to include the old handler implementation even when the new handler is enabled + // The internal legacy test framework requires that the name of the old handler is listed in /ApplicationStatus + String oldHandlerName = "com.yahoo.document.restapi.resource.RestApi"; + String bindingSuffix = "/document/v1/*"; + var oldHandler = newVespaClientHandler(oldHandlerName, options.useNewRestapiHandler ? null : bindingSuffix, options); + cluster.addComponent(oldHandler); + var executor = new Threadpool("restapi-handler", cluster, options.restApiThreadpoolOptions, options.feedThreadPoolSizeFactor); + oldHandler.inject(executor); + oldHandler.addComponent(executor); + + if (options.useNewRestapiHandler) { + String newHandlerName = "com.yahoo.document.restapi.resource.DocumentV1ApiHandler"; + var newHandler = newVespaClientHandler(newHandlerName, bindingSuffix, options); + cluster.addComponent(newHandler); } } @@ -60,6 +65,7 @@ public class ContainerDocumentApi { Options options) { Handler> handler = new Handler<>(new ComponentModel( BundleInstantiationSpecification.getFromStrings(componentId, null, "vespaclient-container-plugin"), "")); + if (bindingSuffix == null) return handler; // TODO(bjorncs,jvenstad) Cleanup once old restapi handler is gone if (options.bindings.isEmpty()) { handler.addServerBindings( SystemBindingPattern.fromHttpPath(bindingSuffix), -- cgit v1.2.3