1,665 bytes added
, 22:00, 9 July 2012
This [[Module Library|XQuery Module]] contains functions for processing servlet request data with the [[RESTXQ]] API.
=Conventions=
All functions in this module are assigned to the {{Code|http://exquery.org/ns/restxq/Request}} namespace, which must be dynamically imported. In this documentation, the {{Code|request}} prefix is used.<br/>Next, the first argument of all functions must be a servlet request container, which can be bound via the <code>[[RESTXQ#Context|%restxq:request(...)]]</code> annotation. An example:
<pre class='brush:xquery'>
module namespace test = 'http://basex.org/examples/test';
import module namespace request = "http://exquery.org/ns/restxq/Request";
declare
%restxq:GET
%restxq:path("...")
%restxq:request("{$request}")
function test:function($request)
{
...
};
...
</pre>
=Functions=
==request:session-id==
{|
|-
| width='90' | '''Signatures'''
|{{Func|request:session-id|$request as basex:request|xs:string}}
|-
| '''Summary'''
|Returns the session ID of a servlet request.
|}
==request:get-attribute==
{|
|-
| width='90' | '''Signatures'''
|{{Func|request:get-attribute|$request as basex:request, $key as xs:string|xs:string?}}
|-
| '''Summary'''
|Returns the value of an attribute bound to the current session, or an empty sequence if no value was bound.
|}
==request:set-attribute==
{|
|-
| width='90' | '''Signatures'''
|{{Func|request:set-attribute|$request as basex:request, $key as xs:string, $value as xs:string|empty-sequence()}}
|-
| '''Summary'''
|Binds an attribute with the specified value to the current session.
|}
=Changelog=
This module was introduced with Version 7.3.1.
[[Category:XQuery]]