A RESTful browser for eXist Java-Based Function Modules


http://exist-db.org/xquery/httpclient
A module for performing HTTP requests as a client

httpclient:clear-persistent-cookies() empty()
Clears any persistent cookies stored in the current session on the client.

httpclient:delete($url as xs:anyURI, $persist as xs:boolean, $request-headers as element()?) item()
Performs a HTTP DELETE request. This method returns the HTTP response encoded as an XML fragment, that looks as follows: <httpclient:response xmlns:httpclient="http://exist-db.org/xquery/httpclient" statusCode="200"><httpclient:headers><httpclient:header name="name" value="value"/>...</httpclient:headers><httpclient:body type="xml|xhtml|text|binary" mimetype="returned content mimetype">body content</httpclient:body></httpclient:response> where XML body content will be returned as a Node, HTML body content will be tidied into an XML compatible form, a body with mime-type of "text/..." will be returned as a URLEncoded string, and any other body content will be returned as xs:base64Binary encoded data.
$urlThe URL to process
$persistThe to indicate if the cookies persist for the query lifetime
$request-headersAny HTTP Request Headers to set in the form <headers><header name="" value=""/></headers>

Returns the XML body content

httpclient:get($url as xs:anyURI, $persist as xs:boolean, $request-headers as element()?) item()
Performs a HTTP GET request. This method returns the HTTP response encoded as an XML fragment, that looks as follows: <httpclient:response xmlns:httpclient="http://exist-db.org/xquery/httpclient" statusCode="200"><httpclient:headers><httpclient:header name="name" value="value"/>...</httpclient:headers><httpclient:body type="xml|xhtml|text|binary" mimetype="returned content mimetype">body content</httpclient:body></httpclient:response> where XML body content will be returned as a Node, HTML body content will be tidied into an XML compatible form, a body with mime-type of "text/..." will be returned as a URLEncoded string, and any other body content will be returned as xs:base64Binary encoded data.
$urlThe URL to process
$persistThe to indicate if the cookies persist for the query lifetime
$request-headersAny HTTP Request Headers to set in the form <headers><header name="" value=""/></headers>

Returns the XML body content

httpclient:head($url as xs:anyURI, $persist as xs:boolean, $request-headers as element()?) item()
Performs a HTTP HEAD request. This method returns the HTTP response encoded as an XML fragment, that looks as follows: <httpclient:response xmlns:httpclient="http://exist-db.org/xquery/httpclient" statusCode="200"><httpclient:headers><httpclient:header name="name" value="value"/>...</httpclient:headers></httpclient:response>
$urlThe URL to process
$persistThe to indicate if the cookies persist for the query lifetime
$request-headersAny HTTP Request Headers to set in the form <headers><header name="" value=""/></headers>

Returns the XML body content

httpclient:options($url as xs:anyURI, $persist as xs:boolean, $request-headers as element()?) item()
Performs a HTTP OPTIONS request. This method returns the HTTP response encoded as an XML fragment, that looks as follows: <httpclient:response xmlns:httpclient="http://exist-db.org/xquery/httpclient" statusCode="200"><httpclient:headers><httpclient:header name="name" value="value"/>...</httpclient:headers></httpclient:response>
$urlThe URL to process
$persistThe to indicate if the cookies persist for the query lifetime
$request-headersAny HTTP Request Headers to set in the form <headers><header name="" value=""/></headers>

Returns the XML body content

httpclient:post($url as xs:anyURI, $content as item(), $persist as xs:boolean, $request-headers as element()?) item()
Performs a HTTP POST request. This method returns the HTTP response encoded as an XML fragment, that looks as follows: <httpclient:response xmlns:httpclient="http://exist-db.org/xquery/httpclient" statusCode="200"><httpclient:headers><httpclient:header name="name" value="value"/>...</httpclient:headers><httpclient:body type="xml|xhtml|text|binary" mimetype="returned content mimetype">body content</httpclient:body></httpclient:response> where XML body content will be returned as a Node, HTML body content will be tidied into an XML compatible form, a body with mime-type of "text/..." will be returned as a URLEncoded string, and any other body content will be returned as xs:base64Binary encoded data.
$urlThe URL to process
$contentThe XML POST payload/content. If it is an XML Node it will be serialized, any other type will be atomized into a string.
$persistThe to indicate if the cookies persist for the query lifetime
$request-headersAny HTTP Request Headers to set in the form <headers><header name="" value=""/></headers>

Returns the XML body content

httpclient:post-form($url as xs:anyURI, $content as element(), $persist as xs:boolean, $request-headers as element()?) item()
Performs a HTTP POST request for a form. This method returns the HTTP response encoded as an XML fragment, that looks as follows: <httpclient:response xmlns:httpclient="http://exist-db.org/xquery/httpclient" statusCode="200"><httpclient:headers><httpclient:header name="name" value="value"/>...</httpclient:headers><httpclient:body type="xml|xhtml|text|binary" mimetype="returned content mimetype">body content</httpclient:body></httpclient:response> where XML body content will be returned as a Node, HTML body content will be tidied into an XML compatible form, a body with mime-type of "text/..." will be returned as a URLEncoded string, and any other body content will be returned as xs:base64Binary encoded data.
$urlThe URL to process
$contentThe form data in the format <httpclient:fields><httpclient:field name="" value="" type="string|file"/>...</httpclient:fields>. If the field values will be suitably URLEncoded and sent with the mime type application/x-www-form-urlencoded.
$persistThe to indicate if the cookies persist for the query lifetime
$request-headersAny HTTP Request Headers to set in the form <headers><header name="" value=""/></headers>

Returns the XML body content

httpclient:put($url as xs:anyURI, $content as node(), $persist as xs:boolean, $request-headers as element()?) item()
Performs a HTTP PUT request.. This method returns the HTTP response encoded as an XML fragment, that looks as follows: <httpclient:response xmlns:httpclient="http://exist-db.org/xquery/httpclient" statusCode="200"><httpclient:headers><httpclient:header name="name" value="value"/>...</httpclient:headers><httpclient:body type="xml|xhtml|text|binary" mimetype="returned content mimetype">body content</httpclient:body></httpclient:response> where XML body content will be returned as a Node, HTML body content will be tidied into an XML compatible form, a body with mime-type of "text/..." will be returned as a URLEncoded string, and any other body content will be returned as xs:base64Binary encoded data.
$urlThe URL to process
$contentThe XML PUT payload/content. If it is an XML Node it will be serialized, any other type will be atomized into a string.
$persistThe to indicate if the cookies persist for the query lifetime
$request-headersAny HTTP Request Headers to set in the form <headers><header name="" value=""/></headers>

Returns the XML body content
Return to list of all modules