Top Description Methods
org.apache.http.cookie

public Interface Cookie

Known Direct Subinterfaces
org.apache.http.cookie.SetCookie, org.apache.http.cookie.ClientCookie
Imports
java.util.Date, org.apache.http.annotation.Obsolete

Cookie interface represents a token or short packet of state information (also referred to as "magic-cookie") that the HTTP agent and the target server can exchange to maintain a session. In its simples form an HTTP cookie is merely a name / value pair.

Please do not use attributes marked as @Obsolete. They have been rendered obsolete by RFC 6265.

Since
4.0

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

comment
getComment
()

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

public String
getCommentURL()

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 String

Returns:

the value of the domain attribute.
getDomain
()

Returns domain attribute of the cookie.

public Date

Returns:

Expiration Date, or null.
getExpiryDate
()

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

public String

Returns:

String name The name
getName
()

Returns the name.

public String

Returns:

The value of the path attribute.
getPath
()

Returns the path attribute of the cookie.

public int[]
getPorts()

Get the Port attribute.

public String

Returns:

String value The current value.
getValue
()

Returns the value.

public int

Returns:

the version of the cookie.
getVersion
()

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

public boolean

Returns:

true if the cookie has expired.
isExpired
(final Date
Current time
date
)

Returns true if this cookie has expired.

public boolean

Returns:

false if the cookie should be discarded at the end of the "session"; true otherwise
isPersistent
()

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

public boolean

Returns:

true if this cookie should only be sent over secure connections, false otherwise.
isSecure
()

Indicates whether this cookie requires a secure connection.

Method Detail

getCommentback to summary
public String getComment()

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

Returns:String

comment

Annotations
@Obsolete
getCommentURLback to summary
public String getCommentURL()

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.

Annotations
@Obsolete
getDomainback to summary
public String getDomain()

Returns domain attribute of the cookie. The value of the Domain attribute specifies the domain for which the cookie is valid.

Returns:String

the value of the domain attribute.

getExpiryDateback to summary
public Date getExpiryDate()

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:Date

Expiration Date, or null.

getNameback to summary
public String getName()

Returns the name.

Returns:String

String name The name

getPathback to summary
public String getPath()

Returns the path attribute of the cookie. The value of the Path attribute specifies the subset of URLs on the origin server to which this cookie applies.

Returns:String

The value of the path attribute.

getPortsback to summary
public int[] getPorts()

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

Annotations
@Obsolete
getValueback to summary
public String getValue()

Returns the value.

Returns:String

String value The current value.

getVersionback to summary
public int getVersion()

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

Returns:int

the version of the cookie.

Annotations
@Obsolete
isExpiredback to summary
public boolean isExpired(final Date date)

Returns true if this cookie has expired.

Parameters
date:Date

Current time

Returns:boolean

true if the cookie has expired.

isPersistentback to summary
public boolean isPersistent()

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

Returns:boolean

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

isSecureback to summary
public boolean isSecure()

Indicates whether this cookie requires a secure connection.

Returns:boolean

true if this cookie should only be sent over secure connections, false otherwise.