Generating HTTP responses

Function: unescaped-data data

Creates a special value which causes data to be printed, as is, without normal escaping. For example, when the output format is XML, then printing "<?xml?>" prints as ‘&lt;?xml?&gt;’, but (unescaped-data "<?xml?>") prints as ‘<?xml?>’.

If using plain Scheme, you need to do the following before using these functions.

(require 'http)

This is not needed for KRL or XQuery.

Function: response-header key value

Create the response header ‘key: value’ in the HTTP response. The result is a "response header value" (of some unspecified type). It does not directly set or print a response header, but only does so when you actually "print" its value to the response output stream.

Function: response-content-type type

Species the content-type of the result - for example "text/plain". Convenience function for (response-header "Content-Type" type).

Function: error-response code [message]

Creates a response-header with an error code of code and a response message of message. (For now this is the same as response-status.)

Note this also returns a response-header value, which does not actually do anything unless it is returned as the result of executing a servlet body.

Function: response-status code [message]

Creates a response-header with an status code of code and a response message of message. (For now this is the same as error-response.)