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