Changes

Jump to navigation Jump to search
No change in size ,  11:58, 6 October 2017
m
Fix error code for rest:single
In many RESTXQ search scenarios, input from browser forms is processed and search results are returned. User experience can generally be made more interactive if an updated search request is triggered with each key click. However, this may lead to many expensive parallel requests, from which only the result of the last request will be relevant for the client.
With the <code>%rest:single</code> annotation, it can be enforced that only one instance of a function will be executed for the same client. If the same function will be called for the second time, the already running query will be stopped, and the HTTP error code {{Code|410460}} (Gone) will be returned instead:
<pre class="brush:xquery">
(: If fast enough, returns the result. Otherwise, if called again, raises 410 460 :)
declare
%rest:path("/search")
By specifying a string along with the annotation, functions can be bundled together, and one request can be canceled by calling another one.
This is shown by another example, in which the first function can be interrupted by the second one. If you call both functions in separate browser tabs, you will note that the first tab will return <code>410460</code>, and the second one will return <xml>stopped</xml>.
<pre class="brush:xquery">
administrator, Bureaucrats, editor, Interface administrators, reviewer, Administrators
400

edits

Navigation menu