Libraries anvil net Cookie

class Cookie
extends anvil.lang.object
Cookie is a small amount of information sent by server to web browser, saved by browser and later sent back to server when the client accesses the same web page.

Constructor
Cookie(string name, string value)
Creates and returns a new Cookie.


Methods

string getComment()
Returns the comment the describing purpose of this cookie.

string getDomain()
Returns the domain name set for this cookie.

int getMaxAge()
Returns the maximum age of the cookie, specified in seconds.

string getName()
Returns the name of cookie.

string getPath()
Returns the paths (that is, URIs) on the server to which the browser returns this cookie.

boolean getSecure()
Returns true is the browser is sending cookies only over secure protocol.

string getValue()
Returns the value of cookie.

int getVersion()
Returns the version of the protocol this cookie complies with.

Cookie setComment(string comment)
Specifies a comment that describes a cookie's purpose. The comment is useful if the browser presents the cookie to the user. Comments are not supported by Netscape Version 0 cookies.

Cookie setDomain(string domain)

Specifies the domain within which this cookie should be presented.

The form of the domain name is specified by RFC 2109. A domain name begins with a dot (.foo.com) and means that the cookie is visible to servers in a specified Domain Name System (DNS) zone (for example, www.foo.com, but not a.b.foo.com). By default, cookies are only returned to the server that sent them.


Cookie setMaxAge(int maxage)

Sets the maximum age of the cookie in seconds.

A positive value indicates that the cookie will expire after that many seconds have passed. Note that the value is the maximum age when the cookie will expire, not the cookie's current age.

A negative value means that the cookie is not stored persistently and will be deleted when the Web browser exits. A zero value causes the cookie to be deleted.


Cookie setPath(string path)
Specifies a path for the cookie, which is the set of URIs (Universal Resource Identifiers, the part of an URL that represents the server path) to which the client should return the cookie.

Cookie setSecure(boolean secure)
Indicates to the browser whether the cookie should only be sent using a secure protocol, such as HTTPS or SSL.

Cookie setValue(string value)
Assigns a new value to a cookie after it is created. Stored value should be encoded with, for instance, BASE64 or URL encoding.

Cookie setVersion(int version)

Sets the version of the cookie protocol this cookie complies with. Version 0 complies with the original Netscape cookie specification. Version 1 complies with RFC 2109.

Since RFC 2109 is still somewhat new, consider version 1 as experimental; do not use it yet on production sites.