Create a cookie header
Pair<String, String> setCookie( String key, String value, Maybe<Time> expires=nothing, Maybe<String> path=nothing, Maybe<String> domain=nothing, Bool secure=false )
key The name of the cookie
value The value of the cookie
expires The time that the cookie expires, which must be in GMT, or nothing if the cookie is a "session cookie" that expires when the web browser is closed (the default).
path The URL path to which the cookie will be returned. The default is nothing which sets it to the URL path of the current document. The URL path must begin with a '/' if it is explicitly set.
domain The domain that the cookies will be sent to. The default of nothing gives the current hostname.
secure If true (the default is false) this cookie will only be sent back to the server over HTTPS connections. Use this if the cookie contains or can be used to access any sensitive information unless you do not have HTTPS available.
Creates a cookie header that can be passed to HTMLDocument.addHTTPHeader (3kaya) or added to the headers list for functions such as Webapp.displayPage_1 (3kaya) Remember that cookies are not available in the page that sets them, since the web browser has not yet received them to send back at that point.
expires = gmTime(time()+3600); // one hour later cookie = setCookie("session",newSession(),just(expires)); addHTTPHeader(doc,cookie);
The
original Netscape cookie specification
has more detail on the use of these fields.
The functioning of the domain part is sometimes problematic. For example, there is no way to set a cookie that should be returned to server.example.com but not to test.server.example.com
Kaya standard library by Edwin Brady, Chris Morris and others ([email protected]). For further information see http://kayalang.org/
The 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.
CGI.header (3kaya)
HTMLDocument.addHTTPHeader (3kaya)
Webapp.displayPage_1 (3kaya)