Changes

Jump to navigation Jump to search
59 bytes added ,  00:01, 14 May 2012
===HTTP Methods===
The HTTP method annotations relate to some of the [http://en.wikipedia.org/wiki/HTTP#Request_methods HTTP request methods] (GET, HEAD, DELETE, POST, PUT). Depending on the request method of the request, a function is invoked.
<!-- TODO [AG] does constraints mean: %rest:GET and %rest:HEAD makes no sense? -->
====Simple Method Annotations====The HTTP method annotations are equivalent to all [http://en.wikipedia.org/wiki/HTTP#Request_methods HTTP request methods] except for TRACE and CONNECT. Zero or more methods may be used on a function; if none is specified, the function will be invoked for each method.All available simple The following function will be called if GET or POST is used as request method annotations
<pre class="brush:xquery">
declare %rest:GET%rest:HEADPOST %rest:DELETEpath("") function local:root() { <html/> };
</pre>
====Content Method Annotations====The variable declaration for processing the content in an XQuery POST and PUT annotations may optionally take a string literal, which will be mapped to a named function is optionalparameter. All available content method annotationsOnce again, the target variable must be embraced by curly brackets
<pre class="brush:xquery">
declare %rest:POST%rest:POSTPUT("{$post-bodydata}")%rest:PUTpath("")%rest function local:PUTput($data) { "Data: "{|| $put-bodydata }");
</pre>
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu