Class BasicClientCookie2

java.lang.Object
org.apache.http.impl.cookie.BasicClientCookie
org.apache.http.impl.cookie.BasicClientCookie2
All Implemented Interfaces:
Cloneable, ClientCookie, Cookie, SetCookie, SetCookie2

public class BasicClientCookie2
extends BasicClientCookie
implements SetCookie2
HTTP "magic-cookie" represents a piece of state information that the HTTP agent and the target server can exchange to maintain a session as specified by RFC2965.
Author:
Oleg Kalnichevski
  • Constructor Details

    • BasicClientCookie2

      public BasicClientCookie2​(String name, String value)
      Default Constructor taking a name and a value. The value may be null.
      Parameters:
      name - The name.
      value - The value.
  • Method Details

    • getPorts

      public int[] getPorts()
      Description copied from class: BasicClientCookie
      Returns null. Cookies prior to RFC2965 do not set this attribute
      Specified by:
      getPorts in interface Cookie
      Overrides:
      getPorts in class BasicClientCookie
    • setPorts

      public void setPorts​(int[] ports)
      Description copied from interface: SetCookie2
      Sets the Port attribute. It restricts the ports to which a cookie may be returned in a Cookie request header.
      Specified by:
      setPorts in interface SetCookie2
    • getCommentURL

      public String getCommentURL()
      Description copied from class: BasicClientCookie
      Returns null. Cookies prior to RFC2965 do not set this attribute
      Specified by:
      getCommentURL in interface Cookie
      Overrides:
      getCommentURL in class BasicClientCookie
    • setCommentURL

      public void setCommentURL​(String commentURL)
      Description copied from interface: SetCookie2
      If a user agent (web browser) presents this cookie to a user, the cookie's purpose will be described by the information at this URL.
      Specified by:
      setCommentURL in interface SetCookie2
    • setDiscard

      public void setDiscard​(boolean discard)
      Description copied from interface: SetCookie2
      Set the Discard attribute. Note: Discard attribute overrides Max-age.
      Specified by:
      setDiscard in interface SetCookie2
      See Also:
      Cookie.isPersistent()
    • isPersistent

      public boolean isPersistent()
      Description copied from class: BasicClientCookie
      Returns false if the cookie should be discarded at the end of the "session"; true otherwise.
      Specified by:
      isPersistent in interface Cookie
      Overrides:
      isPersistent in class BasicClientCookie
      Returns:
      false if the cookie should be discarded at the end of the "session"; true otherwise
    • isExpired

      public boolean isExpired​(Date date)
      Description copied from class: BasicClientCookie
      Returns true if this cookie has expired.
      Specified by:
      isExpired in interface Cookie
      Overrides:
      isExpired in class BasicClientCookie
      Parameters:
      date - Current time
      Returns:
      true if the cookie has expired.
    • clone

      public Object clone() throws CloneNotSupportedException
      Description copied from class: Object
      Creates and returns a copy of this Object. The default implementation returns a so-called "shallow" copy: It creates a new instance of the same class and then copies the field values (including object references) from this instance to the new instance. A "deep" copy, in contrast, would also recursively clone nested objects. A subclass that needs to implement this kind of cloning should call super.clone() to create the new instance and then create deep copies of the nested, mutable objects.
      Overrides:
      clone in class BasicClientCookie
      Returns:
      a copy of this object.
      Throws:
      CloneNotSupportedException - if this object's class does not implement the Cloneable interface.