Database Reference
In-Depth Information
> POST /exist/restxq/any/thing/at/all HTTP/1.1
> User-Agent: curl/7.32.0
> Host: localhost:8080
> Accept: */*
>
< HTTP/1.1 404 Not Found
< Date: Sun, 20 Oct 2013 13:29:14 GMT
< Set-Cookie: JSESSIONID=1dkp1kr1w2zdbrdjfycz9qtaa;Path=/exist
< Expires: Thu, 01 Jan 1970 00:00:00 GMT
< Content-Type: text/html;charset=UTF-8
< Transfer-Encoding: chunked
* Server Jetty(8.1.9.v20130131) is not blacklisted
< Server: Jetty(8.1.9.v20130131)
<
<!DOCTYPE html>
<html>
<head>
<title>Document not found!</title>
</head>
<body>
<p>Sorry, we could not find the document that you requested :-(</p>
</body>
</html>
* Connection #0 to host localhost left intact
The HTTP response is now 404 Not Found , as declared in our rest:response .
The response media type is text/html , which is set by RESTXQ by default when
an HTML output serialization is declared.
The HTML5 doctype has been inserted by the HTML5 output serializer, as
declared by our output:method annotation.
The response body aspect of the sequence results from our XQuery function.
So far, each of the examples that we have looked at has used simple HTTP requests,
but what happens when a POST or PUT request is received that contains a request
body? If you wish to extract the body of the HTTP request, you can declare this
intention on POST and PUT methods by specifying the name of the function parameter
that the body should be injected into. See Example 9-6 .
Example 9-6. Resource function extracting a request body
xquery version "3.0";
module namespace ex = "http://example/restxq/3";
import module namespace rest = "http://exquery.org/ns/restxq";
Search WWH ::




Custom Search