diff options
author | Bjørn Christian Seime <bjorncs@verizonmedia.com> | 2020-10-16 14:25:34 +0200 |
---|---|---|
committer | Bjørn Christian Seime <bjorncs@verizonmedia.com> | 2020-10-16 14:26:40 +0200 |
commit | e49ff4621653db5f5aae496963c36d49b2c6f507 (patch) | |
tree | 5efd0a3124ba07c2c6c6755585e41918fda95266 | |
parent | c4200bbc9896507451c1ac44f50467bb6207868f (diff) |
Temporarily setup old restapi handler w/o binding if new handler is enabled
-rw-r--r-- | config-model/src/main/java/com/yahoo/vespa/model/clients/ContainerDocumentApi.java | 26 |
1 files changed, 16 insertions, 10 deletions
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<AbstractConfigProducer<?>> 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), |