new Cookie()
Represents an HTTP Cookie.
All cookies must have a name and a value and can optionally have other fields set such as path, domain, etc.
(Derived from io.netty.handler.codec.http.Cookie)
- Source:
Methods
encode() → {string}
Encode the cookie to a string. This is what is used in the Set-Cookie header
- Source:
Returns:
the encoded cookie
- Type
- string
getDomain() → {string}
- Source:
Returns:
-
the domain for the cookie
-
- Type
- string
getName() → {string}
- Source:
Returns:
-
the name of this cookie
-
- Type
- string
getPath() → {string}
- Source:
Returns:
the path for this cookie
- Type
- string
getValue() → {string}
- Source:
Returns:
-
the value of this cookie
-
- Type
- string
isChanged() → {boolean}
Has the cookie been changed? Changed cookies will be saved out in the response and sent to the browser.
- Source:
Returns:
true if changed
- Type
- boolean
setChanged(changed)
Set the cookie as being changed. Changed will be true for a cookie just created, false by default if just
read from the request
Parameters:
Name | Type | Description |
---|---|---|
changed |
boolean | true if changed |
- Source:
setDomain(domain) → {Cookie}
Sets the domain of this cookie
Parameters:
Name | Type | Description |
---|---|---|
domain |
string | The domain to use |
- Source:
Returns:
a reference to this, so the API can be used fluently
- Type
- Cookie
setHttpOnly(httpOnly) → {Cookie}
Determines if this cookie is HTTP only.
If set to true, this cookie cannot be accessed by a client
side script. However, this works only if the browser supports it.
For for information, please look
here.
Parameters:
Name | Type | Description |
---|---|---|
httpOnly |
boolean | True if the cookie is HTTP only, otherwise false. |
- Source:
Returns:
- Type
- Cookie
setMaxAge(maxAge) → {Cookie}
Sets the maximum age of this cookie in seconds.
If an age of
0
is specified, this cookie will be
automatically removed by browser because it will expire immediately.
If MIN_VALUE is specified, this cookie will be removed when the
browser is closed.
If you don't set this the cookie will be a session cookie and be removed when the browser is closed.
Parameters:
Name | Type | Description |
---|---|---|
maxAge |
number | The maximum age of this cookie in seconds |
- Source:
Returns:
- Type
- Cookie
setPath(path) → {Cookie}
Sets the path of this cookie.
Parameters:
Name | Type | Description |
---|---|---|
path |
string | The path to use for this cookie |
- Source:
Returns:
a reference to this, so the API can be used fluently
- Type
- Cookie
setSecure(secure) → {Cookie}
Sets the security getStatus of this cookie
Parameters:
Name | Type | Description |
---|---|---|
secure |
boolean | True if this cookie is to be secure, otherwise false |
- Source:
Returns:
a reference to this, so the API can be used fluently
- Type
- Cookie
setValue(value) → {Cookie}
Sets the value of this cookie
Parameters:
Name | Type | Description |
---|---|---|
value |
string | The value to set |
- Source:
Returns:
a reference to this, so the API can be used fluently
- Type
- Cookie