Object built-in object

Object HttpCookie

http Cookie object, used to add and process cookies

Inheritance

#lineWidth: 1.5 #font: Helvetica,sans-Serif #fontSize: 10 #leading: 1.6 #.this: fill=lightgray #.class: fill=white [<class>object|toString();toJSON()] [<this>HttpCookie|new HttpCookie()|name;value;domain;path;expires;httpOnly;secure|parse();match()] [object] <:- [HttpCookie] HttpCookie new HttpCookie() name value domain path expires httpOnly secure parse() match() object toString() toJSON()

Constructor

HttpCookie

HttpCookie constructor to create a new HttpCookie object

1
new HttpCookie(Object opts = {});

Call parameters:

  • opts: Object, specify the properties of the created cookie

The options that opts can set are as follows:

1 2 3 4 5 6 7 8 9
{ "name": "", // 指定创建的 cookie 名称 "value": "", // 指定创建的 cookie 值 "expires": Date, // 指定创建的 cookie 过期时间 "domain": "", // 指定创建的 cookie 的域名范围 "path": "", // 指定创建的 cookie 的路径范围 "secure": false, // 指定创建的 cookie 是否仅通过 https 传递 "httpOnly": false, // 指定创建的 cookie 仅允许 http 请求 }

HttpCookie constructor to create a new HttpCookie object

1 2 3
new HttpCookie(String name, String value, Object opts = {});

Call parameters:

  • name: String, specify the name of the cookie created
  • value: String, specify the value of the cookie created
  • opts: Object, specify other attributes of the created cookie

The options that opts can set are as follows:

1 2 3 4 5 6 7
{ "expires": Date, // 指定创建的 cookie 过期时间 "domain": "", // 指定创建的 cookie 的域名范围 "path": "", // 指定创建的 cookie 的路径范围 "secure": false, // 指定创建的 cookie 是否仅通过 https 传递 "httpOnly": false, // 指定创建的 cookie 仅允许 http 请求 }

Member attributes

name

String, query and set cookie name

1
String HttpCookie.name;

value

String, query and set cookie value

1
String HttpCookie.value;

domain

String, query and set cookie domain name range

1
String HttpCookie.domain;

path

String, query and set cookie path range

1
String HttpCookie.path;

expires

Date, query and set the expiration time of the cookie

1
Date HttpCookie.expires;

httpOnly

Boolean, query and set cookie is only allowed http Request, default false

1
Boolean HttpCookie.httpOnly;

secure

Boolean, query and set whether the cookie is only passed through https, the default is false

1
Boolean HttpCookie.secure;

Member function

parse

Parse the given string and fill the cookie object

1
HttpCookie.parse(String header);

Call parameters:

  • header: String, specify the header string to be parsed

match

Detect the given url Whether it matches the current setting

1
Boolean HttpCookie.match(String url);

Call parameters:

  • url: String, specify the test url

Return result:

  • Boolean, Return true if the match succeeds

toString

Returns the string representation of the object, generally returns "[Native Object]", the object can be re-implemented according to its own characteristics

1
String HttpCookie.toString();

Return result:

  • String, Returns the string representation of the object

toJSON

Returns the JSON format representation of the object, generally returns a collection of readable attributes defined by the object

1
Value HttpCookie.toJSON(String key = "");

Call parameters:

  • key: String, unused

Return result:

  • Value, Returns a value containing JSON serializable