Skip to content

Commit c1b0f6d

Browse files
committed
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
1 parent 98bfb35 commit c1b0f6d

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

app/views/reconcile.scala.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
@()
44

5-
@desc(label: String, link: play.api.mvc.Call) = {
5+
@desc(label: String, call: play.api.mvc.Call) = {
6+
@defining(call.toString.replace("/gnd/reconcile/", "")) { link =>
67
<dt>@Html(label)</dt> <dd><a href='@link'>@java.net.URLDecoder.decode(link.toString.replaceAll("[&?]format=json$", ""), "UTF-8")</a></dd>
8+
}
79
}
810

911
@gnd("GND Reconciliation") {
@@ -62,8 +64,7 @@ <h3>View-API</h3>
6264

6365
<h3>Query-API <small>(<a href="https://www.w3.org/community/reports/reconciliation/CG-FINAL-specs-0.2-20230410/#reconciliation-queries">spec</a>)</small></h3>
6466

65-
<p><b>Query: GET</b><br/>
66-
<a href='@controllers.HomeController.config("host")/?queries={"q1":{"query":"Twain, Mark"}}'>/?queries={"q1":{"query":"Twain, Mark"}}</a>
67+
@desc("Query: GET", routes.Reconcile.main(queries="{\"q1\":{\"query\":\"Twain, Mark\"}}"))
6768
<p><b>Query: POST</b><br/>
6869
<code>curl --data 'queries={"q1":{"query":"Twain, Mark"}}' @controllers.HomeController.config("host")</code></p>
6970

@@ -79,8 +80,7 @@ <h3>Suggest-API <small>(<a href="https://www.w3.org/community/reports/reconcilia
7980
<h3>Data-extension-API</h3>
8081

8182
@desc("Property-proposals (<a href=\"https://www.w3.org/community/reports/reconciliation/CG-FINAL-specs-0.2-20230410/#data-extension-property-proposals\">spec</a>)", routes.Reconcile.properties("","Work",""))
82-
<p><b>Query: GET (<a href=\"https://www.w3.org/community/reports/reconciliation/CG-FINAL-specs-0.2-20230410/#data-extension-service\">spec</a>)</b><br/>
83-
<a href='@controllers.HomeController.config("host")/?extend={"ids":["1081942517","4791358-7"],"properties":[{"id":"preferredName"},{"id":"firstAuthor"}]}'>/?extend={"ids":["1081942517","4791358-7"],"properties":[{"id":"preferredName"},{"id":"firstAuthor"}]}</a>
83+
@desc("Extend: GET (<a href=\"https://www.w3.org/community/reports/reconciliation/CG-FINAL-specs-0.2-20230410/#data-extension-service\">spec</a>)", routes.Reconcile.main(extend="{\"ids\":[\"1081942517\",\"4791358-7\"],\"properties\":[{\"id\":\"preferredName\"},{\"id\":\"firstAuthor\"}]}"))
8484
<p><b>Extend: POST</b><br/>
8585
<code>curl --data 'extend={"ids":["1081942517","4791358-7"],"properties":[{"id":"preferredName"},{"id":"firstAuthor"}]}' @controllers.HomeController.config("host")</code></p>
8686

conf/routes

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,17 @@
22
# This file defines all application routes (Higher priority routes first)
33
# ~~~~
44

5-
# Handle trailing slashes
6-
GET /gnd/reconcile/ controllers.Reconcile.main(callback ?= "", queries ?= "", extend ?= "")
7-
POST /gnd/reconcile/ controllers.Reconcile.reconcile()
8-
GET /*path/ controllers.HomeController.redirectSlash(path: String)
9-
105
#OpenRefine reconciliation endpoint
11-
GET /gnd/reconcile controllers.Reconcile.main(callback ?= "", queries ?= "", extend ?= "")
12-
POST /gnd/reconcile controllers.Reconcile.reconcile()
6+
GET /gnd/reconcile controllers.Default.redirect(to = "/gnd/reconcile/")
7+
GET /gnd/reconcile/ controllers.Reconcile.main(callback ?= "", queries ?= "", extend ?= "")
8+
POST /gnd/reconcile/ controllers.Reconcile.reconcile()
139
GET /gnd/reconcile/properties controllers.Reconcile.properties(callback ?= "", type ?= "", limit ?= "")
1410
GET /gnd/reconcile/suggest/:service controllers.Reconcile.suggest(callback ?= "", service, prefix, type ?= "", type_strict ?= "", limit: Int ?= 10, start: Int ?= 0)
1511
GET /gnd/reconcile/flyout/:service controllers.Reconcile.flyout(callback ?= "", service, id)
1612

13+
# Handle trailing slashes
14+
GET /*path/ controllers.HomeController.redirectSlash(path: String)
15+
1716
GET /gnd controllers.HomeController.index
1817

1918
GET /gnd/api controllers.HomeController.api

0 commit comments

Comments
 (0)