%restxq:cookie-param("username","{$user}")
%restxq:cookie-param("authentication","{$auth}", "no_auth")
</pre>
===Request===
The <code>request</code> annotation is specific to BaseX: servlet request data can be bound
to a variable specified by this annotation and then processed via the [[Request Module|Request Functions]].
The following example returns the current session id:
<pre class="brush:xquery">
import module namespace request = "http://exquery.org/ns/restxq/Request";
declare
%restxq:path("/id")
%restxq:request("{$req}")
function page:id($req)
{
request:session-id($req)
};
</pre>
<body>done</body>
</html>
};
</pre>
==Functions==
The [[Request Module]] provides additional functions to retrieve session data, query parameters and other request-related data.
The following example returns the current session id:
<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")
function test:id()
{
'ID: ' || request:session-id()
};
</pre>