An implementation of RESTful Annotations for XQuery (RESTXQ) in plain
XQuery. Most of this code is standard XQuery 3.0 with map extension,
except for the function used to inspect a function signature and the
calls to the HTTP request module.
This started as a temporary solution until the Java implementation was
available, but I now use it as a quick fallback when I don't want to or
cannot enable the restxq trigger.
author | Wolfgang Meier <wolfgang |
restxq:process($path-info as xs:string?, $functions as function(*)+) as item()*
Main entry point: takes a sequence of functions and tries to match them against the current HTTP request by inspecting their %rest annotations.
$path-info? | the HTTP request path to compare with in %restxq:path. If empty, we'll use the value returned by request:get-path-info(), i.e. any extra path information in the URL after the path leading to the called XQuery. If you call restxq from a controller.xql, you probably want to pass $exist:path as $path-info. |
$functions+ | the sequence of function items to inspect, usually obtained by calling util:list-functions on a module URI. |