Class o2.Cookie


static class o2.Cookie

A cookie helper class.

Defined in cookie.core

Function Summary
static read (String name)

Reads the value of the cookie with the given name.

Usage example:

 var value = o2.Cookie.read('cookieName');
 
static remove (String name, String path, String domain, Boolean isSecure)

Removes a cookie.

Usage example:

 o2.Cookie.remove('testCookie');
 
static save (String name, String value, Integer days, String path, String domain, Boolean isSecure)

Saves a cookie.

Usage example:

 o2.Cookie.save('testCookie', 'testValue', 10);
 

Function Details

function read

static read(String name)

Reads the value of the cookie with the given name.

Usage example:

 var value = o2.Cookie.read('cookieName');
 
Parameters:
name - the name of the cookie to read.
Returns:
the value of the cookie; or null if the cookie is not found.

function remove

static remove(String name, String path, String domain, Boolean isSecure)

Removes a cookie.

Usage example:

 o2.Cookie.remove('testCookie');
 
Parameters:
name - the name of the cookie to remove.
path - (optional) the path of the cookie.
domain - (optional) the domain of the cookie.
isSecure - (optional) will the cookie be used for a secure connection.

function save

static save(String name, String value, Integer days, String path, String domain, Boolean isSecure)

Saves a cookie.

Usage example:

 o2.Cookie.save('testCookie', 'testValue', 10);
 
Parameters:
name - the name of the cookie.
value - the value of the cookie.
days - (optional) how many days should the cookie persist.
path - (optional) the path of the cookie.
domain - (optional) the domain of the cookie.
isSecure - (optional) will the cookie be used for a secure connection.