A RESTful browser for eXist Function Modules


http://exist-db.org/xquery/response
A module for dealing with HTTP responses.

response:exists() xs:boolean
Returns whether a response object exists.

Returns true if the response object exists

response:redirect-to($uri as xs:anyURI) empty()
Sends a HTTP redirect response (302) to the client. Note: this is not supported by the Cocooon generator. Use a sitemap redirect instead.
$uriThe URI to redirect the client to

response:set-cookie($name as xs:string, $value as xs:string) empty()
Sets a HTTP Cookie on the HTTP Response.
$nameThe cookie name
$valueThe cookie value

response:set-cookie($name as xs:string, $value as xs:string, $max-age as xs:duration, $secure-flag as xs:boolean?) empty()
Sets a HTTP Cookie on the HTTP Response.
$nameThe cookie name
$valueThe cookie value
$max-ageThe xs:duration of the cookie
$secure-flagThe flag on whether the cookie is to be secure (eg. only transferred using HTTPS)

response:set-cookie($name as xs:string, $value as xs:string, $max-age as xs:duration, $secure-flag as xs:boolean?, $domain as xs:string?, $path as xs:string?) empty()
Sets a HTTP Cookie on the HTTP Response.
$nameThe cookie name
$valueThe cookie value
$max-ageThe xs:duration of the cookie
$secure-flagThe flag on whether the cookie is to be secure (eg. only transferred using HTTPS)
$domainThe flag on whether the cookie is to be secure (eg. only transferred using HTTPS)
$pathThe flag on whether the cookie is to be secure (eg. only transferred using HTTPS)

response:set-date-header($name as xs:string, $value as xs:string) empty()
Sets a HTTP Header on the HTTP Response.
$nameThe header name
$valueThe header value

response:set-header($name as xs:string, $value as xs:string) empty()
Sets a HTTP Header on the HTTP Response.
$nameThe header name
$valueThe header value

response:set-status-code($code as xs:integer) empty()
Sets a HTTP server status code on the HTTP Response.
$codeThe status code

response:stream($content as item()*, $serialization-options as xs:string) empty()
Stream can only be used within a servlet context. Itt directly streams its input to the servlet's output stream. It should thus be the last statement in the XQuery.
$contentThe source sequence
$serialization-optionsThe serialization options

response:stream-binary($binary-data as xs:base64Binary, $content-type as xs:string, $filename as xs:string?, ...) empty()
Streams the binary data to the current servlet response output stream. The ContentType HTTP header is set to the value given in $content-type.Note: the servlet output stream will be closed afterwards and mime-type settings in the prolog will not be passed.
$binary-dataThe binary data to stream
$content-typeThe ContentType HTTP header value
$filenameThe filename. If no filename is given, then the current request name is used
Return to list of all modules