NewCookie
public class Cookie extends Object
Modifier and Type | Field | Description |
---|---|---|
static int |
DEFAULT_VERSION |
Cookies using the default version correspond to RFC 2109.
|
Constructor | 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 | 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() |
Convert the cookie to a string suitable for use as the value of the
corresponding HTTP header.
|
static Cookie |
valueOf(String value) |
Creates a new instance of
Cookie by parsing the supplied string. |
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
.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()
public String toString()
public int hashCode()
Copyright (c) 2019 Eclipse Foundation. Licensed under Eclipse Foundation Specification License.