Top Description Fields Constructors Methods
javax.ws.rs.core

public Class Cookie

extends Object
Class Inheritance
Known Direct Subclasses
javax.ws.rs.core.NewCookie
Imports
javax.ws.rs.ext.RuntimeDelegate, .RuntimeDelegate.HeaderDelegate

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.
Authors
Paul Sandoz, Marc Hadley
Since
1.0
See Also
IETF RFC 2109

Field Summary

Modifier and TypeField and Description
public static final int
DEFAULT_VERSION

Cookies using the default version correspond to RFC 2109.

private final String
private static final RuntimeDelegate.HeaderDelegate<Cookie>
private final String
private final String
private final String
private final int

Constructor Summary

AccessConstructor and Description

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true, if the object is a Cookie with the same value for all properties, false otherwise.
equals
(final Object
the object to compare to.
obj
)

Overrides java.lang.Object.equals.

Compare for equality.
public String

Returns:

the cookie domain.
getDomain
()

Get the domain of the cookie.

public String

Returns:

the cookie name.
getName
()

Get the name of the cookie.

public String

Returns:

the cookie path.
getPath
()

Get the path of the cookie.

public String

Returns:

the cookie value.
getValue
()

Get the value of the cookie.

public int

Returns:

the cookie version.
getVersion
()

Get the version of the cookie.

public int

Returns:

the cookie hash code.
hashCode
()

Overrides java.lang.Object.hashCode.

Generate a hash code by hashing all of the cookies properties.
public String

Returns:

a stringified cookie.
toString
()

Overrides java.lang.Object.toString.

Convert the cookie to a string suitable for use as the value of the corresponding HTTP header.
public static Cookie

Returns:

the newly created Cookie.
valueOf
(final String
the cookie string.
value
)

Creates a new instance of Cookie by parsing the supplied string.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

DEFAULT_VERSIONback to summary
public static final int DEFAULT_VERSION

Cookies using the default version correspond to RFC 2109.

domainback to summary
private final String domain
HEADER_DELEGATEback to summary
private static final RuntimeDelegate.HeaderDelegate<Cookie> HEADER_DELEGATE
nameback to summary
private final String name
pathback to summary
private final String path
valueback to summary
private final String value
versionback to summary
private final int version

Constructor Detail

Method Detail

equalsback to summary
public boolean equals(final Object obj)

Overrides java.lang.Object.equals.

Compare for equality.

Parameters
obj:Object

the object to compare to.

Returns:boolean

true, if the object is a Cookie with the same value for all properties, false otherwise.

Annotations
@SuppressWarnings:StringEquality, RedundantIfStatement
@Override
getDomainback to summary
public String getDomain()

Get the domain of the cookie.

Returns:String

the cookie domain.

getNameback to summary
public String getName()

Get the name of the cookie.

Returns:String

the cookie name.

getPathback to summary
public String getPath()

Get the path of the cookie.

Returns:String

the cookie path.

getValueback to summary
public String getValue()

Get the value of the cookie.

Returns:String

the cookie value.

getVersionback to summary
public int getVersion()

Get the version of the cookie.

Returns:int

the cookie version.

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Generate a hash code by hashing all of the cookies properties.

Returns:int

the cookie hash code.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Convert the cookie to a string suitable for use as the value of the corresponding HTTP header.

Returns:String

a stringified cookie.

Annotations
@Override
valueOfback to summary
public static Cookie valueOf(final String value)

Creates a new instance of Cookie by parsing the supplied string.

Parameters
value:String

the cookie string.

Returns:Cookie

the newly created Cookie.

Exceptions
IllegalArgumentException:
if the supplied string cannot be parsed or is null.