|
1 |
| -if (starts-with($path, '/sandbox/execute')) |
2 |
| -then |
3 |
| - let $query := request:get-parameter("qu", ()) |
4 |
| - let $startTime := util:system-time() |
5 |
| - return |
6 |
| - <dispatch xmlns="http://exist.sourceforge.net/NS/exist"> |
7 |
| - <!-- Query is executed by XQueryServlet --> |
8 |
| - <forward servlet="XQueryServlet"> |
9 |
| - <!-- Query is passed via the attribute 'xquery.source' --> |
10 |
| - <set-attribute name="xquery.source" value="{$query}"/> |
11 |
| - <!-- Results should be written into attribute 'results' --> |
12 |
| - <set-attribute name="xquery.attribute" value="results"/> |
13 |
| - <!-- Errors should be passed through instead of terminating the request --> |
14 |
| - <set-attribute name="xquery.report-errors" value="yes"/> |
15 |
| - </forward> |
16 |
| - <view> |
17 |
| - <!-- Post process the result: store it into the HTTP session and return the number of hits only. --> |
18 |
| - <forward url="session.xq"> |
19 |
| - <clear-attribute name="xquery.source"/> |
20 |
| - <clear-attribute name="xquery.attribute"/> |
21 |
| - <set-attribute name="elapsed" value="{string(seconds-from-duration(util:system-time() - $startTime))}"/> |
22 |
| - </forward> |
23 |
| - </view> |
24 |
| - </dispatch> |
25 |
| -else if (starts-with($path, '/sandbox/results/')) |
| 1 | +if (starts-with($path, "/sandbox/execute")) |
26 | 2 | then
|
| 3 | + let $query := request:get-parameter("qu", ()) |
| 4 | + let $startTime := util:system-time() |
| 5 | + return |
| 6 | + <dispatch xmlns="http://exist.sourceforge.net/NS/exist"> |
| 7 | + <!-- Query is executed by XQueryServlet --> |
| 8 | + <forward servlet="XQueryServlet"> |
| 9 | + <!-- Query is passed via the attribute "xquery.source" --> |
| 10 | + <set-attribute name="xquery.source" value="{$query}"/> |
| 11 | + <!-- Results should be written into attribute "results" --> |
| 12 | + <set-attribute name="xquery.attribute" value="results"/> |
| 13 | + <!-- Errors should be passed through instead of terminating the request --> |
| 14 | + <set-attribute name="xquery.report-errors" value="yes"/> |
| 15 | + </forward> |
| 16 | + <view> |
| 17 | + <!-- Post process the result: store it into the HTTP session and return the number of hits only. --> |
| 18 | + <forward url="session.xq"> |
| 19 | + <clear-attribute name="xquery.source"/> |
| 20 | + <clear-attribute name="xquery.attribute"/> |
| 21 | + <set-attribute name="elapsed" value="{string(seconds-from-duration(util:system-time() - $startTime))}"/> |
| 22 | + </forward> |
| 23 | + </view> |
| 24 | + </dispatch> |
| 25 | +else |
| 26 | + if (starts-with($path, "/sandbox/results/")) |
| 27 | + then |
27 | 28 | (: Retrieve an item from the query results stored in the HTTP session. The
|
28 | 29 | format of the URL will be /sandbox/results/X, where X is the number of the
|
29 | 30 | item in the result set :)
|
30 | 31 | <dispatch xmlns="http://exist.sourceforge.net/NS/exist">
|
31 |
| - <forward url="../session.xq"> |
32 |
| - <add-parameter name="num" value="{$name}"/> |
33 |
| - </forward> |
34 |
| - </dispatch> |
| 32 | + <forward url="../session.xq"> |
| 33 | + <add-parameter name="num" value="{$name}"/> |
| 34 | + </forward> |
| 35 | + </dispatch> |
0 commit comments