-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontroller.xql
More file actions
executable file
·30 lines (27 loc) · 1.21 KB
/
controller.xql
File metadata and controls
executable file
·30 lines (27 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
xquery version "1.0";
import module namespace config="http://exist-db.org/xquery/apps/config" at "modules/config.xqm";
declare variable $exist:path external;
declare variable $exist:resource external;
if ($exist:path eq "/") then
(: forward root path to index.xql :)
<dispatch xmlns="http://exist.sourceforge.net/NS/exist">
<forward url="index.html"/>
</dispatch>
else if ($exist:resource eq "app.js") then
<dispatch xmlns="http://exist.sourceforge.net/NS/exist">
<forward url="app.xql"/>
</dispatch>
else if (contains($exist:path, '$bargheer-edition$')) then
<dispatch xmlns="http://exist.sourceforge.net/NS/exist">
<forward url="{concat($exist:controller, '/..', replace($exist:path, '.*\$bargheer\-edition\$', substring-after($config:bargheer-edition-root, '/apps')))}"/>
</dispatch>
(:else if (starts-with($exist:path, "/data")) then
<dispatch xmlns="http://exist.sourceforge.net/NS/exist">
<!--<redirect url="/exist/restxq{$exist:path}"/>-->
<forward servlet="RestXqServlet"/>
</dispatch>:)
else
(: everything else is passed through :)
<dispatch xmlns="http://exist.sourceforge.net/NS/exist">
<cache-control cache="yes"/>
</dispatch>