Kawa, the Java-based Scheme system

Node:HTTP response, Previous:HTTP requests, Up:XML tools

### Functions for generating HTTP responses

unescaped-data data | Function

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.

response-header key value | Function

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.

response-content-type type | Function

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

error-response code [message] | Function

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.

response-status code [message] | Function

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`.)