Changes

Jump to navigation Jump to search
27 bytes removed ,  17:59, 16 July 2013
no edit summary
=Usage=
By defaultSince {{Version|7.7}}, the RESTXQ service is by default available at {{Code|http://localhost:8984/restxq/}}.
All RESTXQ [[XQuery 3.0#Annotations|annotations]] are assigned to the {{Code|<nowiki>http://exquery.org/ns/restxq</nowiki>}} namespace, which is statically bound to the {{Code|restxq}} prefix (and since {{Version|7.7}}: {{Code|rest}}). A ''Resource Function'' is an XQuery function that has been marked up with RESTXQ annotations. When an HTTP request comes in, a resource function will be invoked that matches the constraints indicated by its annotations.
Whenever a RESTXQ URL is requested, the [[Options#RESTXQPATH|RESTXQPATH]] module directory and its sub-directories will be parsed for library modules (detected by the extension {{Code|.xqm}}) and functions with RESTXQ annotations. Since {{Version|7.7}}, also main modules (detected by {{Code|.xq}}) will be parsed. All modules will be cached and parsed again when their timestamp changes.
A simple RESTXQ module is shown below. It is part of a clean installation and available at http://localhost:8984/restxq/ .
<pre class="brush:xquery">(: simplified version of the function found in webapp/restxq.xqm :)
};</pre>
If the URI http://localhost:8984/restxq/hello/world is accessed, the result will be kind of
<pre class="brush:xml">
</pre>
If you posted something (e.g. using curl or the embedded form at http://localhost:8984/restxq/ )
<pre class="brush:shell">
curl -i -X POST --data "content='Here comes the post'" http://admin:admin@localhost:8984/restxq/form
</pre>
You would recieve
As an example, returning
<pre class="brush:xml">
<rest:forward>/restxq/hello/universe</rest:forward>
</pre>
would internally forward to http://localhost:8984/restxq/hello/universe
===rest:redirect===
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu