Changes

Jump to navigation Jump to search
209 bytes added ,  21:23, 3 August 2013
</pre>
<!-- TODO how matching works -->
 
===Content Negotiation===
 
Two following annotations can be used to restrict functions to specific content types:
 
* '''HTTP Content Types''': a function will only be invoked if the HTTP {{Code|Content-Type}} header of the request matches one of the given mime types. Example:
<pre class="brush:xquery">%rest:consumes("application/xml", "text/xml")</pre>
* '''HTTP Accept''': a function will only be invoked if the HTTP {{Code|Accept}} header of the request matches one of the defined mime types. Example:
<pre class="brush:xquery">%rest:produces("application/atom+xml")</pre>
 
By default, both mime types are {{Code|*/*}}. Note that this annotation will ''not'' affect the content-type of the HTTP response. Instead, you will need to add a <code>[[#Output|%output:media-type]]</code> annotation.
===HTTP Methods===
{{Mark|Introduced with Version 7.7:}}
Support Some first support for the {{Code|multipart}} content-type types has been added: all parts of multipart messages are now converted to represented as a sequence. Please note that this feature is still experimental, and it may change in a future version BaseX. Your feedback is welcome.An example:
<pre class===Content Negotiation==="brush:xquery">declare %rest:consumes("multipart/mixed") %rest:POST("{$data}") %rest:path("") function page:multipart($data){Two following annotations can be used to restrict functions to specific content types "Number of items:" || count($data)};</pre>
* '''HTTP Content Types''': a function will only be invoked if the HTTP {{Code|Content-Type}} header of the request matches one of the given mime types. Example:<pre class="brush:xquery">%rest:consumes("application/xml", "text/xml")</pre>* '''HTTP Accept''': a function will only be invoked if the HTTP {{Code|Accept}} header of the request matches one of the defined mime types. Example:<pre class="brush:xquery">%rest:produces("application/atom+xml")</pre> By default, both mime types are {{Code|*/*}}. Note Please note that this annotation will ''not'' affect the content-type of the HTTP response. Insteadfeature is still experimental, you will need to add and it may change in a <code>[[#Output|%output:media-type]]</code> annotationfuture version BaseX. Your feedback is welcome.
==Parameters==
Bureaucrats, editor, reviewer, Administrators
13,554

edits

Navigation menu