com.teamdev.jxbrowser.cookies
Class Cookie

java.lang.Object
  extended by com.teamdev.jxbrowser.cookies.Cookie
All Implemented Interfaces:
java.io.Serializable

public class Cookie
extends java.lang.Object
implements java.io.Serializable

Represents a Cookie object.

See Also:
Serialized Form

Constructor Summary
Cookie()
          Constructs empty Cookie object.
Cookie(java.lang.String domain, java.lang.String domainsPath, java.lang.String name, java.lang.String value, boolean secure, boolean httpOnly, boolean session, long expiry)
          Constructs a new Cookie object with the given data.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 java.lang.String getDomain()
          Returns the host or domain for which the cookie is set.
 java.lang.String getDomainsPath()
          Returns the path within the domain for which the cookie is valid.
 long getExpiry()
          Returns cookies expiration time in seconds.
 java.lang.String getName()
          Returns the cookie name.
 java.lang.String getValue()
          Returns string that represents cookie value.
 int hashCode()
           
 java.lang.Boolean isHttpOnly()
           
 boolean isSecure()
          Returns true if cookie should only be sent over a secure connection.
 java.lang.Boolean isSession()
          Returns true if the cookie it's a session cookie.
 void setDomain(java.lang.String domain)
          Sets a new cookie domain.
 void setDomainsPath(java.lang.String domainsPath)
          Sets the cookie domain path.
 void setExpiry(long expiry)
          Sets expiration time in seconds.
 void setHttpOnly(boolean httpOnly)
          Set the cookie http only status.
 void setName(java.lang.String name)
          Sets a new name for cookie.
 void setSecure(boolean secure)
          Sets the cookie secure flag that indicates that cookie should only be sent over a secure connection.
 void setSession(boolean session)
          Set whether cookie stored by session
 void setValue(java.lang.String value)
          Sets value for the cookie.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Cookie

public Cookie()
Constructs empty Cookie object.


Cookie

public Cookie(java.lang.String domain,
              java.lang.String domainsPath,
              java.lang.String name,
              java.lang.String value,
              boolean secure,
              boolean httpOnly,
              boolean session,
              long expiry)
Constructs a new Cookie object with the given data.

Parameters:
domain - the host or domain for which the cookie is set. presence of a leading dot indicates a domain cookie; otherwise, the cookie is treated as a non-domain cookie. see RFC2109.
domainsPath - path within the domain for which the cookie is valid
name - cookie name
value - cookie data
secure - true if the cookie should only be sent over a secure connection.
httpOnly - true if the cookie should only be sent to, and can only be modified by, an http connection.
session - true if the cookie should exist for the current session only. see expiry.
expiry - expiration date, in seconds since midnight (00:00:00), January 1, 1970 UTC. note that expiry time will also be honored for session cookies; in this way, the more restrictive of the two will take effect.
Method Detail

getDomain

public java.lang.String getDomain()
Returns the host or domain for which the cookie is set.

Returns:
cookie the string that represents domain

setDomain

public void setDomain(java.lang.String domain)
Sets a new cookie domain.

Parameters:
domain - a new cookie domain

getDomainsPath

public java.lang.String getDomainsPath()
Returns the path within the domain for which the cookie is valid.

Returns:
the path of cookie in domain

setDomainsPath

public void setDomainsPath(java.lang.String domainsPath)
Sets the cookie domain path.

Parameters:
domainsPath - the cookie domain path

getName

public java.lang.String getName()
Returns the cookie name.

Returns:
the name of cookie.

setName

public void setName(java.lang.String name)
Sets a new name for cookie.

Parameters:
name - the name of cookie

getValue

public java.lang.String getValue()
Returns string that represents cookie value.

Returns:
string that represents cookie value

setValue

public void setValue(java.lang.String value)
Sets value for the cookie.

Parameters:
value - the cookie value

isSecure

public boolean isSecure()
Returns true if cookie should only be sent over a secure connection.

Returns:
true if cookie should only be sent over a secure connection

setSecure

public void setSecure(boolean secure)
Sets the cookie secure flag that indicates that cookie should only be sent over a secure connection.

Parameters:
secure - true if cookie should only be sent over a secure connection

isHttpOnly

public java.lang.Boolean isHttpOnly()
Returns:
the cookie http only status

setHttpOnly

public void setHttpOnly(boolean httpOnly)
Set the cookie http only status.

Parameters:
httpOnly - whether http only status

isSession

public java.lang.Boolean isSession()
Returns true if the cookie it's a session cookie.

Returns:
true if the cookie it's a session cookie

setSession

public void setSession(boolean session)
Set whether cookie stored by session

Parameters:
session - whether cookie stored by session

getExpiry

public long getExpiry()
Returns cookies expiration time in seconds.

Returns:
Expiration time in seconds since midnight (00:00:00), January 1, 1970 UTC. expires = 0 represents a session cookie. expires = 1 represents an expiration time earlier than Jan 1, 1970.

setExpiry

public void setExpiry(long expiry)
Sets expiration time in seconds.

The expiration time defines in seconds since midnight (00:00:00), January 1, 1970 UTC. expires = 0 represents a session cookie. expires = 1 represents an expiration time earlier than Jan 1, 1970.

Parameters:
expiry - the expiration time

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object