Class Cookie

java.lang.Object
org.restlet.data.Cookie
All Implemented Interfaces:
NamedValue<String>
Direct Known Subclasses:
CookieSetting

public class Cookie extends Object implements NamedValue<String>
Cookie provided by a client. To get the list of all cookies sent by a client, you can use the Request.getCookies() method.

Note that if you are on the server side and want to set a cookie on the client, you should use the CookieSetting class instead.

Note that when used with HTTP connectors, this class maps to the "Cookie" header.
Author:
Jerome Louvel
See Also:
  • Constructor Details

    • Cookie

      public Cookie()
      Default constructor.
    • Cookie

      public Cookie(int version, String name, String value)
      Constructor.
      Parameters:
      version - The version number.
      name - The name.
      value - The value.
    • Cookie

      public Cookie(int version, String name, String value, String path, String domain)
      Constructor.
      Parameters:
      version - The version number.
      name - The name.
      value - The value.
      path - The validity path.
      domain - The domain name.
    • Cookie

      public Cookie(String name, String value)
      Constructor.
      Parameters:
      name - The name.
      value - The value.
  • Method Details

    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • getDomain

      public String getDomain()
      Returns the domain name.
      Returns:
      The domain name.
    • getName

      public String getName()
      Returns the name.
      Specified by:
      getName in interface NamedValue<String>
      Returns:
      The name.
    • getPath

      public String getPath()
      Returns the validity path.
      Returns:
      The validity path.
    • getValue

      public String getValue()
      Returns the value.
      Specified by:
      getValue in interface NamedValue<String>
      Returns:
      The value.
    • getVersion

      public int getVersion()
      Returns the cookie specification version.
      Returns:
      The cookie specification version.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • setDomain

      public void setDomain(String domain)
      Sets the domain name.
      Parameters:
      domain - The domain name.
    • setName

      public void setName(String name)
      Sets the name.
      Parameters:
      name - The name.
    • setPath

      public void setPath(String path)
      Sets the validity path.
      Parameters:
      path - The validity path.
    • setValue

      public void setValue(String value)
      Sets the value.
      Specified by:
      setValue in interface NamedValue<String>
      Parameters:
      value - The value.
    • setVersion

      public void setVersion(int version)
      Sets the cookie specification version.
      Parameters:
      version - The cookie specification version.
    • toString

      public String toString()
      Overrides:
      toString in class Object