summaryrefslogtreecommitdiffstats
path: root/sample-apps/http-api-using-searcher/src/main/java/com/yahoo/demo/DemoHandler.java
diff options
context:
space:
mode:
authorKristian Aune <kraune@yahoo-inc.com>2017-08-18 09:14:46 +0200
committerKristian Aune <kraune@yahoo-inc.com>2017-08-18 09:14:46 +0200
commite36ce286e3cc2026fe0ccbbf0e116477b23c70e1 (patch)
tree3d3dadc8869629d7ebc7d019a400fc641a072c4c /sample-apps/http-api-using-searcher/src/main/java/com/yahoo/demo/DemoHandler.java
parenta618787ba847eed7c30f6bd81256db8d39e5e2c4 (diff)
Sample apps moved to vespa-engine/sample-apps
Diffstat (limited to 'sample-apps/http-api-using-searcher/src/main/java/com/yahoo/demo/DemoHandler.java')
-rw-r--r--sample-apps/http-api-using-searcher/src/main/java/com/yahoo/demo/DemoHandler.java50
1 files changed, 0 insertions, 50 deletions
diff --git a/sample-apps/http-api-using-searcher/src/main/java/com/yahoo/demo/DemoHandler.java b/sample-apps/http-api-using-searcher/src/main/java/com/yahoo/demo/DemoHandler.java
deleted file mode 100644
index e5a293846cc..00000000000
--- a/sample-apps/http-api-using-searcher/src/main/java/com/yahoo/demo/DemoHandler.java
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.demo;
-
-import com.google.inject.Inject;
-import com.yahoo.container.jdisc.HttpRequest;
-import com.yahoo.container.jdisc.HttpResponse;
-import com.yahoo.container.jdisc.LoggingRequestHandler;
-import com.yahoo.container.logging.AccessLog;
-import com.yahoo.search.handler.SearchHandler;
-import com.yahoo.search.query.Model;
-import com.yahoo.search.query.Presentation;
-
-import java.util.concurrent.Executor;
-
-/**
- * Forward requests to search handler after adding "Red Hat" as query and "demo"
- * as renderer ID.
- */
-public class DemoHandler extends LoggingRequestHandler {
-
- private final SearchHandler searchHandler;
-
- /**
- * Constructor for use in injection. The requested objects are subclasses of
- * component or have dedicated providers, so the container will know how to
- * create this handler.
- *
- * @param executor
- * threadpool, provided by Vespa
- * @param accessLog
- * access log for incoming queries, provided by Vespa
- * @param searchHandler
- * the Vespa search handler, also automatically injected
- */
- @Inject
- public DemoHandler(Executor executor, AccessLog accessLog,
- SearchHandler searchHandler) {
- super(executor, accessLog, null, true);
- this.searchHandler = searchHandler;
- }
-
- @Override
- public HttpResponse handle(HttpRequest request) {
- HttpRequest searchRequest = new HttpRequest.Builder(request)
- .put(Model.QUERY_STRING, "Red Hat")
- .put(Presentation.FORMAT, "demo").createDirectRequest();
- HttpResponse r = searchHandler.handle(searchRequest);
- return r;
- }
-}