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 hashcode by hashing all of the cookies properties
|
java.lang.String |
toString()
Convert the cookie to a string suitable for use as the value of the
corresponding HTTP header.
|
static Cookie |
valueOf(java.lang.String value)
Creates a new instance of Cookie by parsing the supplied string.
|
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)
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 compliesjava.lang.IllegalArgumentException
- if name is nullpublic Cookie(java.lang.String name, java.lang.String value, java.lang.String path, java.lang.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 validjava.lang.IllegalArgumentException
- if name is nullpublic Cookie(java.lang.String name, java.lang.String value)
name
- the name of the cookievalue
- the value of the cookiejava.lang.IllegalArgumentException
- if name is nullpublic static Cookie valueOf(java.lang.String value) throws java.lang.IllegalArgumentException
value
- the cookie stringjava.lang.IllegalArgumentException
- if the supplied string cannot be parsed
or is nullpublic java.lang.String getName()
public java.lang.String getValue()
public int getVersion()
public java.lang.String getDomain()
public java.lang.String getPath()
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 toCookie
with the same value for
all properties, false otherwise.Copyright © 2016 Oracle Corporation. All Rights Reserved.