SYNOPSISVoid addHTTPHeader( HTMLDocument doc, String name, String value )
doc The HTML document
name The name of the header
value The contents of the header
Adds a HTTP header to the document. If the document is then printed using Webapp.displayPage(3kaya) , these headers will be sent to the client.
The effects of multiple HTTP headers with the same name vary. Some headers may be rewritten by the web server if they appear multiple times.
You can change the HTTP status code using the special Status header. The default is 200, of course - due to a bug in older versions of Apache, explicitly setting a 200 status is not recommended. Headers with names beginning "X-" are non-standard and could mean anything.
addHTTPHeader(doc,"Status","404 File not found");
The characters allowed in HTTP headers are relatively restricted, especially in the name field, the most obvious restriction being that they may not contain new lines. Webapp.displayPage(3kaya) will throw an Exception if illegal characters are found - be sure to check this if you write your own header output function.
RFC 2616 describes the HTTP protocol including HTTP headers in detail
You may set multiple headers with the same name, but this may not be sensible for some headers (for example, multiple Status headers make no sense, whereas multiple Set-Cookie headers are commonly used).
AUTHORSKaya standard library by Edwin Brady, Chris Morris and others ([email protected]). For further information see http://kayalang.org/
LICENSEThe Kaya standard library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (version 2.1 or any later version) as published by the Free Software Foundation.