public class Cookie
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_VERSION
Cookies using the default version correspond to RFC 2109.
|
Constructor and Description |
---|
Cookie(java.lang.String name,
java.lang.String value)
Create a new instance.
|
Cookie(java.lang.String name,
java.lang.String value,
java.lang.String path,
java.lang.String domain)
Create a new instance.
|
Cookie(java.lang.String name,
java.lang.String value,
java.lang.String path,
java.lang.String domain,
int version)
Create a new instance.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj)
Compare for equality.
|
java.lang.String |
getDomain()
Get the domain of the cookie.
|
java.lang.String |
getName()
Get the name of the cookie.
|
java.lang.String |
getPath()
Get the path of the cookie.
|
java.lang.String |
getValue()
Get the value of the cookie.
|
int |
getVersion()
Get the version of the cookie.
|
int |
hashCode()
Generate a hash code by hashing all of the cookies properties.
|
java.lang.String |
toString()
Deprecated.
The format of the toString() method is subject to change in a future version. Please use
RuntimeDelegate.getInstance().createHeaderDelegate(Cookie.class).toString(value) instead if you rely on the format of
this method.
|
static Cookie |
valueOf(java.lang.String value)
Deprecated.
This method will be removed in a future version. Please use
RuntimeDelegate.getInstance().createHeaderDelegate(Cookie.class).fromString(value) instead.
|
public static final int DEFAULT_VERSION
public Cookie(java.lang.String name, java.lang.String value, java.lang.String path, java.lang.String domain, int version) throws java.lang.IllegalArgumentException
name
- the name of the cookie.value
- the value of the cookie.path
- the URI path for which the cookie is valid.domain
- the host domain for which the cookie is valid.version
- the version of the specification to which the cookie complies.java.lang.IllegalArgumentException
- if name is null
.public Cookie(java.lang.String name, java.lang.String value, java.lang.String path, java.lang.String domain) throws java.lang.IllegalArgumentException
name
- the name of the cookie.value
- the value of the cookie.path
- the URI path for which the cookie is valid.domain
- the host domain for which the cookie is valid.java.lang.IllegalArgumentException
- if name is null
.public Cookie(java.lang.String name, java.lang.String value) throws java.lang.IllegalArgumentException
name
- the name of the cookie.value
- the value of the cookie.java.lang.IllegalArgumentException
- if name is null
.@Deprecated public static Cookie valueOf(java.lang.String value)
Cookie
by parsing the supplied string.value
- the cookie string.Cookie
.java.lang.IllegalArgumentException
- if the supplied string cannot be parsed or is null
.public java.lang.String getName()
public java.lang.String getValue()
public int getVersion()
public java.lang.String getDomain()
public java.lang.String getPath()
@Deprecated public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the object to compare to.true
, if the object is a Cookie
with the same value for all properties, false
otherwise.