-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathcontroller.xql
27 lines (22 loc) · 976 Bytes
/
controller.xql
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
xquery version "3.0";
import module namespace console="http://exist-db.org/xquery/console" at "java:org.exist.console.xquery.ConsoleModule";
declare variable $exist:path external;
declare variable $exist:resource external;
declare variable $exist:controller external;
declare variable $exist:prefix external;
declare variable $exist:root external;
(: redirect requests for app root ('') to '/' :)
if ($exist:path eq '') then
<dispatch xmlns="http://exist.sourceforge.net/NS/exist">
<redirect url="{(request:get-header('nginx-request-uri'), request:get-uri())[1]}/"/>
</dispatch>
(: handle request for landing page, e.g., http://history.state.gov/ :)
else if ($exist:path eq "/") then
<dispatch xmlns="http://exist.sourceforge.net/NS/exist">
<forward url="{$exist:controller}/index.xq"/>
</dispatch>
(: handle requests for ajax services :)
else
<dispatch xmlns="http://exist.sourceforge.net/NS/exist">
<ignore/>
</dispatch>