public class Cookie extends Object
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_VERSION
Cookies using the default version correspond to RFC 2109.
|
Constructor and Description |
---|
Cookie(String name,
String value)
Create a new instance.
|
Cookie(String name,
String value,
String path,
String domain)
Create a new instance.
|
Cookie(String name,
String value,
String path,
String domain,
int version)
Create a new instance.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
Compare for equality.
|
String |
getDomain()
Get the domain of the cookie.
|
String |
getName()
Get the name of the cookie.
|
String |
getPath()
Get the path of the cookie.
|
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.
|
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(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(String name, String value, String path, String domain, int version) throws 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.IllegalArgumentException
- if name is null
.public Cookie(String name, String value, String path, String domain) throws 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.IllegalArgumentException
- if name is null
.public Cookie(String name, String value) throws IllegalArgumentException
name
- the name of the cookie.value
- the value of the cookie.IllegalArgumentException
- if name is null
.@Deprecated public static Cookie valueOf(String value)
Cookie
by parsing the supplied string.value
- the cookie string.Cookie
.IllegalArgumentException
- if the supplied string cannot be parsed or is null
.public String getName()
public String getValue()
public int getVersion()
public String getDomain()
public String getPath()
@Deprecated public String toString()
public int hashCode()
Copyright © 2018,2020 Eclipse Foundation.
Use is subject to license terms.