Package: io.vertx.groovy.ext.web

## [Groovy] Class Cookie

- io.vertx.groovy.ext.web.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)

- - ### Constructor Summary

    Constructors
    Constructor and description
    `Cookie (java.lang.Object delegate)`

  - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `static Cookie` | `cookie(java.lang.String name, java.lang.String value)` Create a new cookie
    `java.lang.String` | `encode()` Encode the cookie to a string.
    `java.lang.Object` | `getDelegate()`
    `java.lang.String` | `getDomain()` @return the domain for the cookie
    `java.lang.String` | `getName()` @return the name of this cookie
    `java.lang.String` | `getPath()` @return the path for this cookie
    `java.lang.String` | `getValue()` @return the value of this cookie
    `boolean` | `isChanged()` Has the cookie been changed?
    `void` | `setChanged(boolean changed)` Set the cookie as being changed.
    `Cookie` | `setDomain(java.lang.String domain)` Sets the domain of this cookie
    `Cookie` | `setHttpOnly(boolean httpOnly)` Determines if this cookie is HTTP only.
    `Cookie` | `setMaxAge(long maxAge)` Sets the maximum age of this cookie in seconds.
    `Cookie` | `setPath(java.lang.String path)` Sets the path of this cookie.
    `Cookie` | `setSecure(boolean secure)` Sets the security getStatus of this cookie
    `Cookie` | `setValue(java.lang.String value)` Sets the value of this cookie

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class java.lang.Object` | `java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()`

- - ### Constructor Detail

    - #### Cookie(java.lang.Object delegate)

  - ### Method Detail

    - #### static Cookie cookie(java.lang.String name, java.lang.String value)

      Create a new cookie

      Returns:
        the cookie
      Parameters:
        `name` - the name of the cookie
        `value` - the cookie value

    - #### java.lang.String encode()

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

      Returns:
        the encoded cookie

    - #### java.lang.Object getDelegate()

    - #### java.lang.String getDomain()

      Returns:
        the domain for the cookie

    - #### java.lang.String getName()

      Returns:
        the name of this cookie

    - #### java.lang.String getPath()

      Returns:
        the path for this cookie

    - #### java.lang.String getValue()

      Returns:
        the value of this cookie

    - #### boolean isChanged()

      Has the cookie been changed? Changed cookies will be saved out in the response and sent to the browser.

      Returns:
        true if changed

    - #### void setChanged(boolean 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:
        `changed` - true if changed

    - #### Cookie setDomain(java.lang.String domain)

      Sets the domain of this cookie

      Returns:
        a reference to this, so the API can be used fluently
      Parameters:
        `domain` - The domain to use

    - #### Cookie setHttpOnly(boolean httpOnly)

      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.

      Returns:
      Parameters:
        `httpOnly` - True if the cookie is HTTP only, otherwise false.

    - #### Cookie setMaxAge(long maxAge)

      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 java.lang.Long 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.

      Returns:
      Parameters:
        `maxAge` - The maximum age of this cookie in seconds

    - #### Cookie setPath(java.lang.String path)

      Sets the path of this cookie.

      Returns:
        a reference to this, so the API can be used fluently
      Parameters:
        `path` - The path to use for this cookie

    - #### Cookie setSecure(boolean secure)

      Sets the security getStatus of this cookie

      Returns:
        a reference to this, so the API can be used fluently
      Parameters:
        `secure` - True if this cookie is to be secure, otherwise false

    - #### Cookie setValue(java.lang.String value)

      Sets the value of this cookie

      Returns:
        a reference to this, so the API can be used fluently
      Parameters:
        `value` - The value to set