...
};
...
</pre>
| '''Summary'''
|Returns the session ID of a servlet request.
|-
| '''Examples'''
|
<pre class="brush:xquery">
module namespace test = 'http://basex.org/examples/test';
import module namespace request = "http://exquery.org/ns/restxq/Request";
declare
%restxq:path("/id")
%restxq:request("{$r}")
function test:id($r)
{
'ID: ' || request:session-id($r)
}
</pre>
|}
| '''Summary'''
|Returns the value of an attribute bound to the current session, or an empty sequence if no value was bound.
|-
| '''Examples'''
|
<pre class="brush:xquery">
module namespace test = 'http://basex.org/examples/test';
import module namespace request = "http://exquery.org/ns/restxq/Request";
declare
%restxq:path("/get")
%restxq:query-param("key", "{$key}", "")
%restxq:request("{$req}")
function test:get($req, $key)
{
'Value of ' || $key || ': ' || $value
};
</pre>
|}
| '''Summary'''
|Binds an attribute with the specified value to the current session.
|-
| '''Examples'''
|
<pre class="brush:xquery">
module namespace test = 'http://basex.org/examples/test';
import module namespace request = "http://exquery.org/ns/restxq/Request";
declare
%restxq:path("/set")
%restxq:query-param("key", "{$key}", "")
%restxq:query-param("value", "{$value}", "")
%restxq:request("{$req}")
function test:set($req, $key, $value)
{
request:set-attribute($req, $key, $value),
'Attribute was set.'
};
</pre>
|}