Skip to content

Most visited

Recently visited

navigation

BasicClientCookie2 | Android Developers

to top
Android APIs
public class

BasicClientCookie2

extends BasicClientCookie
implements SetCookie2
java.lang.Object
   ↳ org.apache.http.impl.cookie.BasicClientCookie
     ↳ org.apache.http.impl.cookie.BasicClientCookie2

Class Overview

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.

Summary

[Expand]
Inherited Constants
From interface org.apache.http.cookie.ClientCookie
Public Constructors
BasicClientCookie2(String name, String value)
Default Constructor taking a name and a value.
Public Methods
Object clone()
Creates and returns a copy of this Object.
String getCommentURL()
Returns null.
int[] getPorts()
Returns null.
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.
void setCommentURL(String commentURL)
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.
void setDiscard(boolean discard)
Set the Discard attribute.
void setPorts(int[] ports)
Sets the Port attribute.
[Expand]
Inherited Methods
From class org.apache.http.impl.cookie.BasicClientCookie
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
From interface org.apache.http.cookie.SetCookie2

Public Constructors

public BasicClientCookie2 (String name, String value)

Added in API level 1

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 ()

Added in API level 1

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.

Returns
  • a copy of this object.

public String getCommentURL ()

Added in API level 1

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

public int[] getPorts ()

Added in API level 1

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

public boolean isExpired (Date date)

Added in API level 1

Returns true if this cookie has expired.

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

public boolean isPersistent ()

Added in API level 1

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 void setCommentURL (String commentURL)

Added in API level 1

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.

public void setDiscard (boolean discard)

Added in API level 1

Set the Discard attribute. Note: Discard attribute overrides Max-age.

public void setPorts (int[] ports)

Added in API level 1

Sets the Port attribute. It restricts the ports to which a cookie may be returned in a Cookie request header.

This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a one-minute survey?
Help us improve Android tools and documentation.