Main Content

matlab.net.http.CookieInfo class

Package:matlab.net.http

HTTP cookie information

Description

TheCookieInfoclass contains aCookieobject and information about the cookie that you can use for cookie management. To obtain aCookieInfoobject, call theconvertmethod of aSetCookieFieldobject in a response message.

Unlike browsers, MATLAB®does not provide an automatic cookie store. You must save cookies on your own and send them back to servers as needed.

Class Attributes

Sealed
true

For information on class attributes, seeClass Attributes.

Creation

Description

obj = matlab.net.http.CookieInfo(Name,Value)creates aCookieInfoobject with additional properties specified by one, or more name-value pair arguments.Nameis the property name andValueis the corresponding value. You can specify several name-value pair arguments in any order asName1,Value1,...,NameN,ValueN. Unspecified properties are set to their default values.

Use this constructor for testing.

Properties

expand all

Cookie, specified as amatlab.net.http.Cookieobject. Insert the Cookie into a request messageCookieFieldproperty.

Attributes:

GetAccess
public
SetAccess
public

Cookie expiration time, specified as adatetimeobject. If there is anExpiresattribute in the header field, then theExpiresproperty is set. If theExpiresattribute cannot be parsed, thenExpiresis NaT.

Attributes:

GetAccess
public
SetAccess
public

Data Types:datetime

Duration of cookie, specified as an integer or NaN. If there is aMax-Ageattribute in the header field, then theMaxAgeproperty is set. If theMax-Ageattribute cannot be parsed, thenMaxAge是南。

Attributes:

GetAccess
public
SetAccess
public

Cookie domain, specified as a string. If the Set-Cookie field does not specify aDomainattribute, then theDomainproperty is set to the request messageURI.Hostproperty andHostOnlyis set totrue.Domainnever begins with a period, as described inRFC 6265 — HTTP State Management Mechanism, Section 5.2.3.

Attributes:

GetAccess
public
SetAccess
public

Data Types:string

Path attribute in a Set-Cookie field, specified as a string. ThePathproperty is the value of thePathattribute in the Set-Cookie field. If the field does not contain a path attribute, then thePathproperty is set todefault-pathbased on the request messageURI.Pathproperty. For a description ofdefault-path, seeRFC 6265 — HTTP State Management Mechanism, Section 5.1.4. Paths and Path-Match.Pathalways begins with a slash (/) character.

Attributes:

GetAccess
public
SetAccess
public

Data Types:string

Secure属性的状态, where theSecureproperty is specified astrueorfalse. TheSecureproperty indicates that the Set-Cookie field contains aSecureattribute.

Attributes:

GetAccess
public
SetAccess
public

Data Types:logical

HttpOnly属性的状态, where theHttpOnlyproperty is specified astrueorfalse. TheHttpOnlyproperty indicates that the Set-Cookie field contains anHttpOnlyattribute.

Attributes:

GetAccess
public
SetAccess
public

Data Types:logical

Values ofextension-av属性, specified as a string. The entire attribute is a single string, even if its syntax is of the formname=value.

Attributes:

GetAccess
public
SetAccess
public

Data Types:string

Domain属性的状态, where theHostOnlyproperty is specified astrueorfalse. If the Set-Cookie field contains aDomainattribute, thenHostOnlyis true.

Attributes:

GetAccess
public
SetAccess
public

Data Types:logical

Cookie expiration, specified as adatetimeobject.

  • If the Set-Cookie field contains either anExpiresor aMax-Ageattribute, thenExpirationTimeis set to the attribute.

  • If neither attribute appears, thenExpirationTimeis set todatetime('Inf')and the cookie is retained until the current session is over.

Attributes:

GetAccess
public
SetAccess
public

Data Types:datetime

Time the cookie was created, specified as adatetimeobject. TheSetCookieField.convert方法集CreationTimeto the current time.

If a newCookieInfoobject matches an existing one, then the new object replaces the old one. However, theCreationTimeproperty does not change. This behavior is specified inRFC 6265 — HTTP State Management Mechanism, Section 5.3 Storage Model, step 11.3. TheCookieInfoobjects match when theCookie.Name,CookieInfo.Domain, andCookieInfo.Path(if specified) properties are equal.

Attributes:

GetAccess
public
SetAccess
public

Data Types:datetime

Methods

expand all

版本历史

Introduced in R2016b