# Class: Cookie

## vertx-web-js/cookie~ Cookie

#### 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:
  - vertx-web-js/cookie.js, line 33

### Methods

#### encode() → {string}

Encode the cookie to a string. This is what is used in the Set-Cookie header

Source:
  - vertx-web-js/cookie.js, line 196

##### Returns:

the encoded cookie

Type
  string

#### getDomain() → {string}

Source:
  - vertx-web-js/cookie.js, line 100

##### Returns:

the domain for the cookie

Type
  string

#### getName() → {string}

Source:
  - vertx-web-js/cookie.js, line 44

##### Returns:

the name of this cookie

Type
  string

#### getPath() → {string}

Source:
  - vertx-web-js/cookie.js, line 128

##### Returns:

the path for this cookie

Type
  string

#### getValue() → {string}

Source:
  - vertx-web-js/cookie.js, line 57

##### 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:
  - vertx-web-js/cookie.js, line 210

##### Returns:

true if changed

Type
  boolean

#### isFromUserAgent() → {boolean}

Has this Cookie been sent from the User Agent (the browser)? or was created during the executing on the request.

Source:
  - vertx-web-js/cookie.js, line 238

##### Returns:

true if the cookie comes from the User Agent.

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:
  - vertx-web-js/cookie.js, line 224

#### setDomain(domain) → {Cookie}

Sets the domain of this cookie

##### Parameters:

Name | Type | Description
--- | --- | ---
`domain` | string | The domain to use

Source:
  - vertx-web-js/cookie.js, line 86

##### 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:
  - vertx-web-js/cookie.js, line 181

##### 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:
  - vertx-web-js/cookie.js, line 147

##### 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:
  - vertx-web-js/cookie.js, line 114

##### 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:
  - vertx-web-js/cookie.js, line 162

##### 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:
  - vertx-web-js/cookie.js, line 71

##### Returns:

a reference to this, so the API can be used fluently

Type
  Cookie