From c1b0f6d2399a9a2ef94ba982b14e8654c022ce29 Mon Sep 17 00:00:00 2001 From: Fabian Steeg Date: Fri, 13 Sep 2024 16:24:37 +0200 Subject: [PATCH] Use trailing slash as default for `gnd/reconcile/` route - Allows usage of relative links both in `reconcile` subdomain deployment as well as in lobid.org/gnd/reconcile/ deployment - Switch back to the `@desc` block for query and extend GET sample --- app/views/reconcile.scala.html | 10 +++++----- conf/routes | 13 ++++++------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/app/views/reconcile.scala.html b/app/views/reconcile.scala.html index 06743a6..224b01f 100644 --- a/app/views/reconcile.scala.html +++ b/app/views/reconcile.scala.html @@ -2,8 +2,10 @@ @() -@desc(label: String, link: play.api.mvc.Call) = { +@desc(label: String, call: play.api.mvc.Call) = { + @defining(call.toString.replace("/gnd/reconcile/", "")) { link =>
@Html(label)
@java.net.URLDecoder.decode(link.toString.replaceAll("[&?]format=json$", ""), "UTF-8")
+ } } @gnd("GND Reconciliation") { @@ -62,8 +64,7 @@

View-API

Query-API (spec)

-

Query: GET
- /?queries={"q1":{"query":"Twain, Mark"}} + @desc("Query: GET", routes.Reconcile.main(queries="{\"q1\":{\"query\":\"Twain, Mark\"}}"))

Query: POST
curl --data 'queries={"q1":{"query":"Twain, Mark"}}' @controllers.HomeController.config("host")

@@ -79,8 +80,7 @@

Suggest-API (spec)", routes.Reconcile.properties("","Work","")) -

Query: GET (spec)
- /?extend={"ids":["1081942517","4791358-7"],"properties":[{"id":"preferredName"},{"id":"firstAuthor"}]} + @desc("Extend: GET (spec)", routes.Reconcile.main(extend="{\"ids\":[\"1081942517\",\"4791358-7\"],\"properties\":[{\"id\":\"preferredName\"},{\"id\":\"firstAuthor\"}]}"))

Extend: POST
curl --data 'extend={"ids":["1081942517","4791358-7"],"properties":[{"id":"preferredName"},{"id":"firstAuthor"}]}' @controllers.HomeController.config("host")

diff --git a/conf/routes b/conf/routes index 3f86859..effb1c5 100644 --- a/conf/routes +++ b/conf/routes @@ -2,18 +2,17 @@ # This file defines all application routes (Higher priority routes first) # ~~~~ -# Handle trailing slashes -GET /gnd/reconcile/ controllers.Reconcile.main(callback ?= "", queries ?= "", extend ?= "") -POST /gnd/reconcile/ controllers.Reconcile.reconcile() -GET /*path/ controllers.HomeController.redirectSlash(path: String) - #OpenRefine reconciliation endpoint -GET /gnd/reconcile controllers.Reconcile.main(callback ?= "", queries ?= "", extend ?= "") -POST /gnd/reconcile controllers.Reconcile.reconcile() +GET /gnd/reconcile controllers.Default.redirect(to = "/gnd/reconcile/") +GET /gnd/reconcile/ controllers.Reconcile.main(callback ?= "", queries ?= "", extend ?= "") +POST /gnd/reconcile/ controllers.Reconcile.reconcile() GET /gnd/reconcile/properties controllers.Reconcile.properties(callback ?= "", type ?= "", limit ?= "") GET /gnd/reconcile/suggest/:service controllers.Reconcile.suggest(callback ?= "", service, prefix, type ?= "", type_strict ?= "", limit: Int ?= 10, start: Int ?= 0) GET /gnd/reconcile/flyout/:service controllers.Reconcile.flyout(callback ?= "", service, id) +# Handle trailing slashes +GET /*path/ controllers.HomeController.redirectSlash(path: String) + GET /gnd controllers.HomeController.index GET /gnd/api controllers.HomeController.api