## org.jboss.netty.handler.codec.http
Class DefaultCookie

    java.lang.Object
      org.jboss.netty.handler.codec.http.DefaultCookie

All Implemented Interfaces:
  Comparable<Cookie>, Cookie

    public class DefaultCookie

extends Object
implements Cookie

The default `Cookie` implementation.

Version:
  $Rev: 2080 $, $Date: 2010-01-26 18:04:19 +0900 (Tue, 26 Jan 2010) $
Author:
  The Netty Project, Andy Taylor (andy.taylor@jboss.org), Trustin Lee

Constructor Summary
`DefaultCookie(String name, String value)` Creates a new cookie with the specified name and value.

Method Summary
`int` `compareTo(Cookie c)`
`boolean` `equals(Object o)`
`String` `getComment()` Returns the comment of this cookie.
`String` `getCommentUrl()` Returns the comment URL of this cookie.
`String` `getDomain()` Returns the domain of this cookie.
`int` `getMaxAge()` Returns the max age of this cookie in seconds.
`String` `getName()` Returns the name of this cookie.
`String` `getPath()` Returns the path of this cookie.
`Set<Integer>` `getPorts()` Returns the ports of this cookie.
`String` `getValue()` Returns the value of this cookie.
`int` `getVersion()` Returns the version of this cookie.
`int` `hashCode()`
`boolean` `isDiscard()` Returns the discard flag of this cookie.
`boolean` `isHttpOnly()` Returns if this cookie cannot be accessed through client side script.
`boolean` `isSecure()` Returns the secure flag of this cookie.
`void` `setComment(String comment)` Sets the comment of this cookie.
`void` `setCommentUrl(String commentUrl)` Sets the comment URL of this cookie.
`void` `setDiscard(boolean discard)` Sets the discard flag of this cookie.
`void` `setDomain(String domain)` Sets the domain of this cookie.
`void` `setHttpOnly(boolean httpOnly)` Sets if this cookie cannot be accessed through client side script.
`void` `setMaxAge(int maxAge)` Sets the max age of this cookie in seconds.
`void` `setPath(String path)` Sets the path of this cookie.
`void` `setPorts(int... ports)` Sets the ports of this cookie.
`void` `setPorts(Iterable<Integer> ports)` Sets the ports of this cookie.
`void` `setSecure(boolean secure)` Sets the secure flag of this cookie.
`void` `setValue(String value)` Sets the value of this cookie.
`void` `setVersion(int version)` Sets the version of this cookie.
`String` `toString()`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### DefaultCookie

    public DefaultCookie(String name,
                         String value)

  Creates a new cookie with the specified name and value.

Method Detail

### getName

    public String getName()

  Description copied from interface: `Cookie`
  Returns the name of this cookie.

  Specified by:
    `getName` in interface `Cookie`

### getValue

    public String getValue()

  Description copied from interface: `Cookie`
  Returns the value of this cookie.

  Specified by:
    `getValue` in interface `Cookie`

### setValue

    public void setValue(String value)

  Description copied from interface: `Cookie`
  Sets the value of this cookie.

  Specified by:
    `setValue` in interface `Cookie`

### getDomain

    public String getDomain()

  Description copied from interface: `Cookie`
  Returns the domain of this cookie.

  Specified by:
    `getDomain` in interface `Cookie`

### setDomain

    public void setDomain(String domain)

  Description copied from interface: `Cookie`
  Sets the domain of this cookie.

  Specified by:
    `setDomain` in interface `Cookie`

### getPath

    public String getPath()

  Description copied from interface: `Cookie`
  Returns the path of this cookie.

  Specified by:
    `getPath` in interface `Cookie`

### setPath

    public void setPath(String path)

  Description copied from interface: `Cookie`
  Sets the path of this cookie.

  Specified by:
    `setPath` in interface `Cookie`

### getComment

    public String getComment()

  Description copied from interface: `Cookie`
  Returns the comment of this cookie.

  Specified by:
    `getComment` in interface `Cookie`

### setComment

    public void setComment(String comment)

  Description copied from interface: `Cookie`
  Sets the comment of this cookie.

  Specified by:
    `setComment` in interface `Cookie`

### getCommentUrl

    public String getCommentUrl()

  Description copied from interface: `Cookie`
  Returns the comment URL of this cookie.

  Specified by:
    `getCommentUrl` in interface `Cookie`

### setCommentUrl

    public void setCommentUrl(String commentUrl)

  Description copied from interface: `Cookie`
  Sets the comment URL of this cookie.

  Specified by:
    `setCommentUrl` in interface `Cookie`

### isDiscard

    public boolean isDiscard()

  Description copied from interface: `Cookie`
  Returns the discard flag of this cookie.

  Specified by:
    `isDiscard` in interface `Cookie`

### setDiscard

    public void setDiscard(boolean discard)

  Description copied from interface: `Cookie`
  Sets the discard flag of this cookie.

  Specified by:
    `setDiscard` in interface `Cookie`

### getPorts

    public Set<Integer> getPorts()

  Description copied from interface: `Cookie`
  Returns the ports of this cookie.

  Specified by:
    `getPorts` in interface `Cookie`

### setPorts

    public void setPorts(int... ports)

  Description copied from interface: `Cookie`
  Sets the ports of this cookie.

  Specified by:
    `setPorts` in interface `Cookie`

### setPorts

    public void setPorts(Iterable<Integer> ports)

  Description copied from interface: `Cookie`
  Sets the ports of this cookie.

  Specified by:
    `setPorts` in interface `Cookie`

### getMaxAge

    public int getMaxAge()

  Description copied from interface: `Cookie`
  Returns the max age of this cookie in seconds.

  Specified by:
    `getMaxAge` in interface `Cookie`

### setMaxAge

    public void setMaxAge(int maxAge)

  Description copied from interface: `Cookie`
  Sets the max age of this cookie in seconds. If `0` is specified, this cookie will be removed by browser because it will be expired immediately. If `-1` is specified, this cookie will be removed when a user terminates browser.

  Specified by:
    `setMaxAge` in interface `Cookie`

### getVersion

    public int getVersion()

  Description copied from interface: `Cookie`
  Returns the version of this cookie.

  Specified by:
    `getVersion` in interface `Cookie`

### setVersion

    public void setVersion(int version)

  Description copied from interface: `Cookie`
  Sets the version of this cookie.

  Specified by:
    `setVersion` in interface `Cookie`

### isSecure

    public boolean isSecure()

  Description copied from interface: `Cookie`
  Returns the secure flag of this cookie.

  Specified by:
    `isSecure` in interface `Cookie`

### setSecure

    public void setSecure(boolean secure)

  Description copied from interface: `Cookie`
  Sets the secure flag of this cookie.

  Specified by:
    `setSecure` in interface `Cookie`

### isHttpOnly

    public boolean isHttpOnly()

  Description copied from interface: `Cookie`
  Returns if this cookie cannot be accessed through client side script. This flag works only if the browser supports it. For more information, see here.

  Specified by:
    `isHttpOnly` in interface `Cookie`

### setHttpOnly

    public void setHttpOnly(boolean httpOnly)

  Description copied from interface: `Cookie`
  Sets if this cookie cannot be accessed through client side script. This flag works only if the browser supports it. For more information, see here.

  Specified by:
    `setHttpOnly` in interface `Cookie`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`

### equals

    public boolean equals(Object o)

  Overrides:
    `equals` in class `Object`

### compareTo

    public int compareTo(Cookie c)

  Specified by:
    `compareTo` in interface `Comparable<Cookie>`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

Copyright © 2008-2010 JBoss, a division of Red Hat, Inc.. All Rights Reserved.