=Response=
Since RESTXQ runs on a fully equipped Web-server, one can change all and specify more HTTP header informations that are returned to the client. By default, a successful request is answered with the HTTP status code "200 OK" , and is followed by the given content, ; an erroneous request leads to an error code and an optional error message (due to errors in a script) with e.g. {{Code|404}} for "404 Not Foundresource not found" followed by the error message).
The first behavior Custom responses can be changed built within in XQuery by returning an <code>rest:response</code> element, following an <code>http:response</code> child node that matches the syntax of the [http://expath.org/spec/http-client EXPath HTTP Client Module] specification, and more optional child nodes that will be serialized. E.g. one may return to the client
<pre class="brush:xml">
<rest:response> <http:response status="418404" message="I'm a teapotwas not found."> <http:header name="Content-Language" value="en"/> <http:header name="Content-Type" value="text/html; charset=utf-8"/> </http:response> </rest:response> <html> <body>My Message</body> </html>
</pre>
Compare [http://en.wikipedia.org/wiki/List_of_HTTP_status_codes List of HTTP status codes] to see what status code fits.It is mandatory to first place <code>rest:response</code> followed by the content (of any kind) if any. In case of an updating function, use [[Database_Module#db:output|db:output()]] to return the element and the content.
=Forward and Redirect=