Added API versioning backwards compability and tests.
Change-Id: I8a7b512bea67e07e449074a4d04c257b65ae1454
diff --git a/lite/src/main/java/de/ids_mannheim/korap/server/KustvaktLiteServer.java b/lite/src/main/java/de/ids_mannheim/korap/server/KustvaktLiteServer.java
index 66329ef..448d4f6 100644
--- a/lite/src/main/java/de/ids_mannheim/korap/server/KustvaktLiteServer.java
+++ b/lite/src/main/java/de/ids_mannheim/korap/server/KustvaktLiteServer.java
@@ -10,7 +10,6 @@
public class KustvaktLiteServer extends KustvaktBaseServer {
-
public static void main (String[] args) throws Exception {
KustvaktLiteServer server = new KustvaktLiteServer();
kargs = server.readAttributes(args);
@@ -20,20 +19,22 @@
File f = new File("kustvakt-lite.conf");
Properties properties = new Properties();
InputStream in = null;
-
- if (!f.exists()){
- in = KustvaktLiteServer.class.getClassLoader().getResourceAsStream("kustvakt-lite.conf");
+
+ if (!f.exists()) {
+ in = KustvaktLiteServer.class.getClassLoader()
+ .getResourceAsStream("kustvakt-lite.conf");
}
- else{
+ else {
in = new FileInputStream(f);
}
-
+
properties.load(in);
in.close();
config = new KustvaktConfiguration(properties);
-
+
kargs.setSpringConfig("lite-config.xml");
- rootPackages = "de.ids_mannheim.korap.web.service.lite";
+ rootPackages =
+ "de.ids_mannheim.korap.web";
server.start();
}
diff --git a/lite/src/main/java/de/ids_mannheim/korap/web/service/lite/LiteService.java b/lite/src/main/java/de/ids_mannheim/korap/web/service/lite/LiteService.java
index f5b648b..d268617 100644
--- a/lite/src/main/java/de/ids_mannheim/korap/web/service/lite/LiteService.java
+++ b/lite/src/main/java/de/ids_mannheim/korap/web/service/lite/LiteService.java
@@ -33,10 +33,10 @@
import de.ids_mannheim.korap.query.serialize.QuerySerializer;
import de.ids_mannheim.korap.resource.rewrite.RewriteHandler;
import de.ids_mannheim.korap.utils.KoralCollectionQueryBuilder;
+import de.ids_mannheim.korap.web.APIVersionFilter;
import de.ids_mannheim.korap.web.ClientsHandler;
import de.ids_mannheim.korap.web.CoreResponseHandler;
import de.ids_mannheim.korap.web.SearchKrill;
-import de.ids_mannheim.korap.web.APIVersionFilter;
/**
* @author hanl
@@ -50,7 +50,7 @@
* - removed version from service paths
* - altered service with path /search and method trace to path
* /query and method get
- * - added API versioning
+ * - added API URL versioning
* </pre>
*/
@Controller
@@ -62,7 +62,7 @@
private static Logger jlog = LogManager.getLogger(LiteService.class);
@Autowired
- CoreResponseHandler kustvaktResponseHandler;
+ private CoreResponseHandler kustvaktResponseHandler;
@Autowired
private SearchKrill searchKrill;
private ClientsHandler graphDBhandler;
diff --git a/lite/src/main/resources/kustvakt-lite.conf b/lite/src/main/resources/kustvakt-lite.conf
index 79e2211..f0dd6b3 100644
--- a/lite/src/main/resources/kustvakt-lite.conf
+++ b/lite/src/main/resources/kustvakt-lite.conf
@@ -6,6 +6,15 @@
krill.index.commit.auto = 500
krill.index.relations.max = 100
+krill.namedVC=vc
+
+
+# Kustvakt
+
+current.api.version = v1.0
+# multiple versions separated by space
+supported.api.version = v1.0
+
kustvakt.base.url=/api/*
kustvakt.default.pos = tt
kustvakt.default.lemma = tt