NewCookiepublic 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 hashcode 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)
name - the name of the cookievalue - the value of the cookiepath - the URI path for which the cookie is validdomain - the host domain for which the cookie is validversion - the version of the specification to which the cookie compliesIllegalArgumentException - if name is nullpublic Cookie(String name, String value, String path, String domain)
name - the name of the cookievalue - the value of the cookiepath - the URI path for which the cookie is validdomain - the host domain for which the cookie is validIllegalArgumentException - if name is nullpublic Cookie(String name, String value)
name - the name of the cookievalue - the value of the cookieIllegalArgumentException - if name is nullpublic static Cookie valueOf(String value) throws IllegalArgumentException
value - the cookie stringIllegalArgumentException - if the supplied string cannot be parsed
or is nullpublic String getName()
public String getValue()
public int getVersion()
public String getDomain()
public String getPath()
public String toString()
public int hashCode()
Copyright © 2019 Sun Microsystems, Inc. All rights reserved.