API Overview API Index Package Overview Direct link to this page
JDK 1.6
  java.net. HttpCookie View Source
Author(s)
Edward Wang
Since
1.6
Version
1.5, 05/11/17
Serial
Hierarchy
 Object
      HttpCookie
Implements
 Cloneable
Subclasses
Description
publicfinal class HttpCookie
  An HttpCookie object represents an http cookie, which carries state information between server and user agent.
See also:   
Constructors
public HttpCookie (String name, String value)
  Constructs a cookie with a specified name and value.
Methods
Hide/Show inherited methods
public Object clone ()
  Create and return a copy of this object.
publicstatic boolean domainMatches (String domain, String host)
  The utility method to check whether a host name is in a domain or not.
public boolean equals (Object obj)
  Test the equality of two http cookies.
public String getComment ()
  Returns the comment describing the purpose of this cookie, or null if the cookie has no comment.
public String getCommentURL ()
  Returns the comment url describing the purpose of this cookie, or null if the cookie has no comment url.
public boolean getDiscard ()
  Return the discard attribute of the cookie
public String getDomain ()
  Returns the domain name set for this cookie.
public long getMaxAge ()
  Returns the maximum age of the cookie, specified in seconds.
public String getName ()
  Returns the name of the cookie.
public String getPath ()
  Returns the path on the server to which the browser returns this cookie.
public String getPortlist ()
  Return the port list attribute of the cookie
public boolean getSecure ()
  Returns true if the browser is sending cookies only over a secure protocol, or false if the browser can send cookies using any protocol.
public String getValue ()
  Returns the value of the cookie.
public int getVersion ()
  Returns the version of the protocol this cookie complies with.
public boolean hasExpired ()
  Reports whether this http cookie has expired or not.
public int hashCode ()
  Return hash code of this http cookie.
publicstatic List<HttpCookie> parse (String header)
  Constructs cookies from set-cookie or set-cookie2 header string.
public void setComment (String purpose)
  Specifies a comment that describes a cookie's purpose.
public void setCommentURL (String purpose)
  Specifies a comment url that describes a cookie's purpose.
public void setDiscard (boolean discard)
  Specify whether user agent should discard the cookie unconditionally.
public void setDomain (String pattern)
  Specifies the domain within which this cookie should be presented.
public void setMaxAge (long expiry)
  Sets the maximum age of the cookie in seconds.
public void setPath (String uri)
  Specifies a path for the cookie to which the client should return the cookie.
public void setPortlist (String ports)
  Specify the portlist of the cookie, which restricts the port(s) to which a cookie may be sent back in a Cookie header.
public void setSecure (boolean flag)
  Indicates to the browser whether the cookie should only be sent using a secure protocol, such as HTTPS or SSL.
public void setValue (String newValue)
  Assigns a new value to a cookie after the cookie is created.
public void setVersion (int v)
  Sets the version of the cookie protocol this cookie complies with.
public String toString ()
  Constructs a cookie header string representation of this cookie, which is in the format defined by corresponding cookie specification, but without the leading "Cookie:" token.
Fields
Hide/Show inherited fields
pack-privatestatic Map<String, CookieAttributeAssignor> assignors
Nested Classes
  HttpCookie.CookieAttributeAssignor
Generated By: JavaOnTracks Doclet 0.1.4     ©Thibaut Colar