matlab.net.http.CookieInfo Class
Namespace: matlab.net.http
HTTP cookie information
Description
The CookieInfo
class contains a Cookie
object and
information about the cookie that you can use for cookie management. To obtain a
CookieInfo
object, call the convert
method of a
SetCookieField
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 a
CookieInfo
object with additional properties specified by one, or more
name-value pair arguments. Name
is the property name and
Value
is the corresponding value. You can specify several name-value
pair arguments in any order as Name1,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 a matlab.net.http.Cookie
object. Insert
the Cookie into a request message CookieField
property.
Attributes:
GetAccess | public |
SetAccess | public |
Expires
— Cookie expiration time
datetime
| NaT
Cookie expiration time, specified as a datetime
object. If there
is an Expires
attribute in the header field, then the
Expires
property is set. If the Expires
attribute cannot be parsed, then Expires
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 a
Max-Age
attribute in the header field, then the
MaxAge
property is set. If the Max-Age
attribute cannot be parsed, then MaxAge
is NaN.
Attributes:
GetAccess | public |
SetAccess | public |
Domain
— Cookie domain
string
Cookie domain, specified as a string. If the Set-Cookie field does not specify a
Domain
attribute, then the Domain
property is
set to the request message URI.Host
property and
HostOnly
is set to true
.
Domain
never begins with a period, as described in RFC 6265 HTTP
State Management Mechanism, Section 5.2.3 on the RFC Editor website.
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. The
Path
property is the value of the Path
attribute in the Set-Cookie field. If the field does not contain a path attribute, then
the Path
property is set to default-path
based
on the request message URI.Path
property. For a description of
default-path
, see RFC 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
attribute status
false
(default) | true
Secure
attribute status, where the Secure
property is specified as true
or false
. The
Secure
property indicates that the Set-Cookie field contains a
Secure
attribute.
Attributes:
GetAccess | public |
SetAccess | public |
Data Types: logical
HttpOnly
— HttpOnly
attribute status
false
(default) | true
HttpOnly
attribute status, where the
HttpOnly
property is specified as true
or
false
. The HttpOnly
property indicates that
the Set-Cookie field contains an HttpOnly
attribute.
Attributes:
GetAccess | public |
SetAccess | public |
Data Types: logical
Extensions
— Values of extension-av
attributes
string
Values of extension-av
attributes, specified as a string. The
entire attribute is a single string, even if its syntax is of the form
name=value
.
Attributes:
GetAccess | public |
SetAccess | public |
Data Types: string
HostOnly
— Domain
attribute status
true
(default) | false
Domain
attribute status, where the HostOnly
property is specified as true
or false
. If the
Set-Cookie field contains a Domain
attribute, then
HostOnly
is true.
Attributes:
GetAccess | public |
SetAccess | public |
Data Types: logical
ExpirationTime
— Cookie expiration
datetime
Cookie expiration, specified as a datetime
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 a datetime
object. The
SetCookieField.convert
method sets CreationTime
to the current time.
If a new CookieInfo
object matches an existing one, then the new
object replaces the old one. However, the CreationTime
property
does not change. This behavior is specified in RFC 6265 HTTP State Management Mechanism,
Section 5.3 Storage Model, step 11.3. The CookieInfo
objects match when
the Cookie.Name
, CookieInfo.Domain
, and
CookieInfo.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 |
char | Cookie info as character vector |
Version History
Introduced in R2016b
See Also
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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)