Database Reference
In-Depth Information
http
Description
Performing HTTP requests as a client (EXPath)
Namespace
http="http://expath.org/ns/http-client"
Type/default status
Java; enabled in $EXIST_HOME/conf.xml
Class
org.expath.exist.HttpClientModule
This is a module that allows you to send out HTTP requests according to the EXPath
HTTP Client module specifications (refer to http://www.expath.org/modules/http-
client/ and http://www.expath.org/spec/http-client ). The functions expect an XML
fragment that contains the specification of the request and returns an XML fragment
with its results.
For instance, the following example fires an HTTP GET request at the local eXist
REST interface (see “Querying the Database Using REST” on page 94 ). The result is a
directory listing of /db :
let $ http-request-data := <request xmlns = " http://expath.org/ns/http-client "
method = " GET " href = " http://localhost:8080/exist/rest/db " />
return
http:send-request ( $ http-request-data )
The result is another XML fragment that provides you with the result and all the
HTTP properties surrounding this:
<http:response xmlns:http= "http://expath.org/ns/http-client"
status= "200"
message= "OK" >
<http:header name= "date" value= "Tue, 20 Nov 2012 14:49:55 GMT" />
<http:header name= "set-cookie"
value= "JSESSIONID=1jkifx0ip6jin6kswi0n96q54;Path=/exist" />
<http:header name= "expires" value= "Thu, 01 Jan 1970 00:00:00 GMT" />
<http:header name= "content-type" value= "application/xml; charset=UTF-8" />
<http:header name= "last-modified" value= "Tue, 25 Sep 2012 08:15:31 GMT" />
<http:header name= "created" value= "Tue, 25 Sep 2012 08:15:31 GMT" />
<http:header name= "transfer-encoding" value= "chunked" />
<http:header name= "server" value= "Jetty(8.1.3.v20120416)" />
<http:body media-type= "application/xml" />
</http:response>
<exist:result xmlns:exist= "http://exist.sourceforge.net/NS/exist" >
<exist:collection name= "/db" created= "2012-09-25T10:15:30.686+02:00"
owner= "SYSTEM" group= "dba" permissions= "rwxr-xr-x" >
 
Search WWH ::




Custom Search