public class

BasicClientCookie

extends Object
implements Serializable Cloneable ClientCookie SetCookie
java.lang.Object
   ↳ org.apache.http.impl.cookie.BasicClientCookie
Known Direct Subclasses

Class Overview

Default implementation of SetCookie.

Summary

[Expand]
Inherited Constants
From interface org.apache.http.cookie.ClientCookie
Public Constructors
BasicClientCookie(String name, String value)
Default Constructor taking a name and a value.
Public Methods
Object clone()
boolean containsAttribute(String name)
String getAttribute(String name)
String getComment()
Returns the comment describing the purpose of this cookie, or null if no such comment has been defined.
String getCommentURL()
Returns null.
String getDomain()
Returns domain attribute of the cookie.
Date getExpiryDate()
Returns the expiration Date of the cookie, or null if none exists.
String getName()
Returns the name.
String getPath()
Returns the path attribute of the cookie
int[] getPorts()
Returns null.
String getValue()
Returns the value.
int getVersion()
Returns the version of the cookie specification to which this cookie conforms.
boolean isExpired(Date date)
Returns true if this cookie has expired.
boolean isPersistent()
Returns false if the cookie should be discarded at the end of the "session"; true otherwise.
boolean isSecure()
Indicates whether this cookie requires a secure connection.
void setAttribute(String name, String value)
void setComment(String comment)
If a user agent (web browser) presents this cookie to a user, the cookie's purpose will be described using this comment.
void setDomain(String domain)
Sets the domain attribute.
void setExpiryDate(Date expiryDate)
Sets expiration date.
void setPath(String path)
Sets the path attribute.
void setSecure(boolean secure)
Sets the secure attribute of the cookie.
void setValue(String value)
Sets the value
void setVersion(int version)
Sets the version of the cookie specification to which this cookie conforms.
String toString()
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.apache.http.cookie.ClientCookie
From interface org.apache.http.cookie.Cookie
From interface org.apache.http.cookie.SetCookie

Public Constructors

public BasicClientCookie (String name, String value)

Also: HttpClient

Default Constructor taking a name and a value. The value may be null.

Parameters
name The name.
value The value.

Public Methods

public Object clone ()

Also: HttpClient

public boolean containsAttribute (String name)

Also: HttpClient

public String getAttribute (String name)

Also: HttpClient

public String getComment ()

Also: HttpClient

Returns the comment describing the purpose of this cookie, or null if no such comment has been defined.

Returns
  • comment

public String getCommentURL ()

Also: HttpClient

Returns null. Cookies prior to RFC2965 do not set this attribute

public String getDomain ()

Also: HttpClient

Returns domain attribute of the cookie.

Returns
  • the value of the domain attribute

public Date getExpiryDate ()

Also: HttpClient

Returns the expiration Date of the cookie, or null if none exists.

Note: the object returned by this method is considered immutable. Changing it (e.g. using setTime()) could result in undefined behaviour. Do so at your peril.

Returns
  • Expiration Date, or null.

public String getName ()

Also: HttpClient

Returns the name.

Returns
  • String name The name

public String getPath ()

Also: HttpClient

Returns the path attribute of the cookie

Returns
  • The value of the path attribute.

public int[] getPorts ()

Also: HttpClient

Returns null. Cookies prior to RFC2965 do not set this attribute

public String getValue ()

Also: HttpClient

Returns the value.

Returns
  • String value The current value.

public int getVersion ()

Also: HttpClient

Returns the version of the cookie specification to which this cookie conforms.

Returns
  • the version of the cookie.
See Also

public boolean isExpired (Date date)

Also: HttpClient

Returns true if this cookie has expired.

Parameters
date Current time
Returns
  • true if the cookie has expired.

public boolean isPersistent ()

Also: HttpClient

Returns false if the cookie should be discarded at the end of the "session"; true otherwise.

Returns
  • false if the cookie should be discarded at the end of the "session"; true otherwise

public boolean isSecure ()

Also: HttpClient

Indicates whether this cookie requires a secure connection.

Returns
  • true if this cookie should only be sent over secure connections.

public void setAttribute (String name, String value)

Also: HttpClient

public void setComment (String comment)

Also: HttpClient

If a user agent (web browser) presents this cookie to a user, the cookie's purpose will be described using this comment.

See Also

public void setDomain (String domain)

Also: HttpClient

Sets the domain attribute.

Parameters
domain The value of the domain attribute
See Also

public void setExpiryDate (Date expiryDate)

Also: HttpClient

Sets expiration date.

Note: the object returned by this method is considered immutable. Changing it (e.g. using setTime()) could result in undefined behaviour. Do so at your peril.

Parameters
expiryDate the Date after which this cookie is no longer valid.
See Also

public void setPath (String path)

Also: HttpClient

Sets the path attribute.

Parameters
path The value of the path attribute
See Also

public void setSecure (boolean secure)

Also: HttpClient

Sets the secure attribute of the cookie.

When true the cookie should only be sent using a secure protocol (https). This should only be set when the cookie's originating server used a secure protocol to set the cookie's value.

Parameters
secure The value of the secure attribute
See Also

public void setValue (String value)

Also: HttpClient

Sets the value

public void setVersion (int version)

Also: HttpClient

Sets the version of the cookie specification to which this cookie conforms.

Parameters
version the version of the cookie.
See Also

public String toString ()