Package javax.ws.rs.core
Class Cookie
java.lang.Object
javax.ws.rs.core.Cookie
- Direct Known Subclasses:
NewCookie
Represents the value of a HTTP cookie, transferred in a request.
RFC 2109 specifies the legal characters for name,
value, path and domain. The default version of 1 corresponds to RFC 2109.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Compare for equalityGet the domain of the cookiegetName()
Get the name of the cookiegetPath()
Get the path of the cookiegetValue()
Get the value of the cookieint
Get the version of the cookieint
hashCode()
Generate a hashcode by hashing all of the cookies propertiestoString()
Convert the cookie to a string suitable for use as the value of the corresponding HTTP header.static Cookie
Creates a new instance of Cookie by parsing the supplied string.
-
Field Details
-
DEFAULT_VERSION
public static final int DEFAULT_VERSIONCookies using the default version correspond to RFC 2109.- See Also:
-
delegate
-
name
-
value
-
version
private int version -
path
-
domain
-
-
Constructor Details
-
Cookie
Create a new instance.- Parameters:
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 complies- Throws:
IllegalArgumentException
- if name is null
-
Cookie
Create a new instance.- Parameters:
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 valid- Throws:
IllegalArgumentException
- if name is null
-
Cookie
Create a new instance.- Parameters:
name
- the name of the cookievalue
- the value of the cookie- Throws:
IllegalArgumentException
- if name is null
-
-
Method Details
-
valueOf
Creates a new instance of Cookie by parsing the supplied string.- Parameters:
value
- the cookie string- Returns:
- the newly created Cookie
- Throws:
IllegalArgumentException
- if the supplied string cannot be parsed or is null
-
getName
Get the name of the cookie- Returns:
- the name
-
getValue
Get the value of the cookie- Returns:
- the value
-
getVersion
public int getVersion()Get the version of the cookie- Returns:
- the version
-
getDomain
Get the domain of the cookie- Returns:
- the domain
-
getPath
Get the path of the cookie- Returns:
- the path
-
toString
Convert the cookie to a string suitable for use as the value of the corresponding HTTP header. -
hashCode
public int hashCode()Generate a hashcode by hashing all of the cookies properties -
equals
Compare for equality
-