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

### Methods

#### encode() → {string}

  Encode the cookie to a string. This is what is used in the Set-Cookie header
  Source:
    - cookie.js, line 197

  ##### Returns:

  the encoded cookie
  Type
    string

#### getDomain() → {string}

  Source:
    - cookie.js, line 103

  ##### Returns:

  - the domain for the cookie
  - Type
      string

#### getName() → {string}

  Source:
    - cookie.js, line 45

  ##### Returns:

  - the name of this cookie
  - Type
      string

#### getPath() → {string}

  Source:
    - cookie.js, line 131

  ##### Returns:

  the path for this cookie
  Type
    string

#### getValue() → {string}

  Source:
    - cookie.js, line 59

  ##### 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:
    - cookie.js, line 211

  ##### 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:
    - cookie.js, line 225

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

  Sets the domain of this cookie

  ##### Parameters:

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

  Source:
    - cookie.js, line 88

  ##### 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:
    - cookie.js, line 183

  ##### 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:
    - cookie.js, line 150

  ##### 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:
    - cookie.js, line 117

  ##### 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:
    - cookie.js, line 164

  ##### 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:
    - cookie.js, line 73

  ##### Returns:

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