Difference between revisions of "Request Module"

From BaseX Documentation
Jump to navigation Jump to search
Line 1: Line 1:
This [[Module Library|XQuery Module]] contains functions for processing servlet request data with the [[RESTXQ]] API. Note that, for now, the proposed functions are specific to BaseX and are not described in Adam’s Retter upcoming RESTXQ documentation.
+
This [[Module Library|XQuery Module]] contains functions for processing servlet request data with the [[RESTXQ]] API. Note that, for now, the proposed functions are specific to BaseX and are not described in the existing RESTXQ documentations.
  
 
=Conventions=
 
=Conventions=

Revision as of 22:04, 9 July 2012

This XQuery Module contains functions for processing servlet request data with the RESTXQ API. Note that, for now, the proposed functions are specific to BaseX and are not described in the existing RESTXQ documentations.

Conventions

All functions in this module are assigned to the http://exquery.org/ns/restxq/Request namespace, which must be dynamically imported. In this documentation, the request prefix is used. Next, the first argument of all functions must be a servlet request container, bound via the %restxq:request(...) annotation. An example:

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)
{
  ...
};
...

Functions

request:session-id

Signatures request:session-id($request as basex:request) as xs:string
Summary Returns the session ID of a servlet request.

request:get-attribute

Signatures request:get-attribute($request as basex:request, $key as xs:string) as 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

Signatures request:set-attribute($request as basex:request, $key as xs:string, $value as xs:string) as empty-sequence()
Summary Binds an attribute with the specified value to the current session.

Changelog

This module was introduced with Version 7.3.1.