matlab.net.http.CookieInfo class
Package:matlab.net.http
HTTP cookie information
Description
TheCookieInfo
class contains aCookie
object and information about the cookie that you can use for cookie management. To obtain aCookieInfo
object, call theconvert
method of aSetCookieField
object 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.
Creation
Description
obj = matlab.net.http.CookieInfo(Name,Value)
creates aCookieInfo
object with additional properties specified by one, or more name-value pair arguments.Name
is the property name andValue
is 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
Cookie
—Cookie
matlab.net.http.Cookie
object
Cookie, specified as amatlab.net.http.Cookie
object. Insert the Cookie into a request messageCookieField
property.
Attributes:
GetAccess |
public
|
SetAccess |
public
|
Expires
—Cookie expiration time
datetime
|NaT
Cookie expiration time, specified as adatetime
object. If there is anExpires
attribute in the header field, then theExpires
property is set. If theExpires
attribute cannot be parsed, thenExpires
is NaT.
Attributes:
GetAccess |
public
|
SetAccess |
public
|
Data Types:datetime
MaxAge
—Duration of cookie
integer|NaN
Duration of cookie, specified as an integer or NaN. If there is aMax-Age
attribute in the header field, then theMaxAge
property is set. If theMax-Age
attribute cannot be parsed, thenMaxAge
是南。
Attributes:
GetAccess |
public
|
SetAccess |
public
|
Domain
—Cookie domain
string
Cookie domain, specified as a string. If the Set-Cookie field does not specify aDomain
attribute, then theDomain
property is set to the request messageURI.Host
property andHostOnly
is set totrue
.Domain
never 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
—Path attribute in Set-Cookie field
string
Path attribute in a Set-Cookie field, specified as a string. ThePath
property is the value of thePath
attribute in the Set-Cookie field. If the field does not contain a path attribute, then thePath
property is set todefault-path
based on the request messageURI.Path
property. For a description ofdefault-path
, seeRFC 6265 — HTTP State Management Mechanism, Section 5.1.4. Paths and Path-Match.Path
always begins with a slash (/
) character.
Attributes:
GetAccess |
public
|
SetAccess |
public
|
Data Types:string
Secure
—Secure
属性的状态
false
(default) |true
Secure
属性的状态, where theSecure
property is specified astrue
orfalse
. TheSecure
property indicates that the Set-Cookie field contains aSecure
attribute.
Attributes:
GetAccess |
public
|
SetAccess |
public
|
Data Types:logical
HttpOnly
—HttpOnly
属性的状态
false
(default) |true
HttpOnly
属性的状态, where theHttpOnly
property is specified astrue
orfalse
. TheHttpOnly
property indicates that the Set-Cookie field contains anHttpOnly
attribute.
Attributes:
GetAccess |
public
|
SetAccess |
public
|
Data Types:logical
Extensions
—Values ofextension-av
属性
string
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
HostOnly
—Domain
属性的状态
true
(default) |false
Domain
属性的状态, where theHostOnly
property is specified astrue
orfalse
. If the Set-Cookie field contains aDomain
attribute, thenHostOnly
is true.
Attributes:
GetAccess |
public
|
SetAccess |
public
|
Data Types:logical
ExpirationTime
—Cookie expiration
datetime
Cookie expiration, specified as adatetime
object.
If the Set-Cookie field contains either an
Expires
or aMax-Age
attribute, thenExpirationTime
is set to the attribute.If neither attribute appears, then
ExpirationTime
is set todatetime('Inf')
and the cookie is retained until the current session is over.
Attributes:
GetAccess |
public
|
SetAccess |
public
|
Data Types:datetime
CreationTime
—Time cookie was created
datetime
Time the cookie was created, specified as adatetime
object. TheSetCookieField.convert
方法集CreationTime
to the current time.
If a newCookieInfo
object matches an existing one, then the new object replaces the old one. However, theCreationTime
property does not change. This behavior is specified inRFC 6265 — HTTP State Management Mechanism, Section 5.3 Storage Model, step 11.3. TheCookieInfo
objects match when theCookie.Name
,CookieInfo.Domain
, andCookieInfo.Path
(if specified) properties are equal.
Attributes:
GetAccess |
public
|
SetAccess |
public
|
Data Types:datetime
Methods
Public Methods
matlab.net.http.CookieInfo.collectFromLog |
Latest CookieInfo objects from HTTP response message history |
Specialized Operators and Functions
These methods specialize standard MATLAB operators and functions for objects in this class.
string |
Cookie info as string as it appears in a |
字符 |
Cookie info as character vector |
版本历史
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select:.
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina(Español)
- Canada(English)
- United States(English)
Europe
- Belgium(English)
- Denmark(English)
- Deutschland(Deutsch)
- España(Español)
- Finland(English)
- France(Français)
- Ireland(English)
- Italia(Italiano)
- Luxembourg(English)
- Netherlands(English)
- Norway(English)
- Österreich(Deutsch)
- Portugal(English)
- Sweden(English)
- Switzerland
- United Kingdom(English)