XQuery Function Documentation

Search and Browse

http://exist-db.org/xquery/response

java:org.exist.xquery.functions.response.ResponseModule

A module for dealing with HTTP responses.

response:exists

response:exists() as xs:boolean

Returns whether a response object exists.

Returns:
xs:boolean : true if the response object exists

response:redirect-to

response:redirect-to($uri as xs:anyURI) as empty-sequence()

Sends a HTTP redirect response (302) to the client.

Parameters:
$uri The URI to redirect the client to
Returns:
empty-sequence()

response:set-cookie

response:set-cookie($name as xs:string, $value as xs:string) as empty-sequence()

Sets a HTTP Cookie on the HTTP Response.

Parameters:
$name The cookie name
$value The cookie value
Returns:
empty-sequence()

response:set-cookie

response:set-cookie($name as xs:string, $value as xs:string, $max-age as xs:duration?, $secure-flag as xs:boolean?) as empty-sequence()

Sets a HTTP Cookie on the HTTP Response.

Parameters:
$name The cookie name
$value The cookie value
$max-age? The xs:duration of the cookie
$secure-flag? The flag for whether the cookie is to be secure (i.e., only transferred using HTTPS)
Returns:
empty-sequence()

response:set-cookie

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?) as empty-sequence()

Sets a HTTP Cookie on the HTTP Response.

Parameters:
$name The cookie name
$value The cookie value
$max-age? The xs:duration of the cookie
$secure-flag? The flag for whether the cookie is to be secure (i.e., only transferred using HTTPS)
$domain? The cookie domain
$path? The cookie path
Returns:
empty-sequence()

response:set-date-header

response:set-date-header($name as xs:string, $value as xs:string) as empty-sequence()

Sets a HTTP Header on the HTTP Response.

Parameters:
$name The header name
$value The header value
Returns:
empty-sequence()

response:set-header

response:set-header($name as xs:string, $value as xs:string) as empty-sequence()

Sets a HTTP Header on the HTTP Response.

Parameters:
$name The header name
$value The header value
Returns:
empty-sequence()

response:set-status-code

response:set-status-code($code as xs:integer) as empty-sequence()

Sets a HTTP server status code on the HTTP Response.

Parameters:
$code The status code
Returns:
empty-sequence()

response:stream

response:stream($content as item()*, $serialization-options as xs:string) as empty-sequence()

Stream can only be used within a servlet context. It directly streams its input to the servlet's output stream. It should thus be the last statement in the XQuery.

Parameters:
$content* The source sequence
$serialization-options The serialization options
Returns:
empty-sequence()

response:stream-binary

response:stream-binary($binary-data as xs:base64Binary, $content-type as xs:string, $filename as xs:string?) as empty-sequence()

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.

Parameters:
$binary-data The binary data to stream
$content-type The ContentType HTTP header value
$filename? The filename. If provided, a Content-Disposition header is set for the filename in the HTTP Response
Returns:
empty-sequence()