Class Cookie
java.lang.Object
jakarta.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.
- Since:
- 1.0
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intCookies using the default version correspond to RFC 2109.private final Stringprivate static final RuntimeDelegate.HeaderDelegate<Cookie> Deprecated.This field will be removed in a future version.private final Stringprivate final Stringprivate final Stringprivate final int -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCookie(Cookie.AbstractCookieBuilder<?> builder) Create a new instance from the suppliedCookie.AbstractCookieBuilderinstance.Deprecated.This constructor will be removed in a future version.Deprecated.This constructor will be removed in a future version.Deprecated.This constructor will be removed in a future version. -
Method Summary
Modifier and TypeMethodDescriptionbooleanCompare for equality.Get the domain of the cookie.getName()Get the name of the cookie.getPath()Get the path of the cookie.getValue()Get the value of the cookie.intGet the version of the cookie.inthashCode()Generate a hash code by hashing all of the cookies properties.toString()Deprecated.The format of the toString() method is subject to change in a future version.static CookieDeprecated.This method will be removed in a future version.
-
Field Details
-
DEFAULT_VERSION
public static final int DEFAULT_VERSIONCookies using the default version correspond to RFC 2109.- See Also:
-
HEADER_DELEGATE
Deprecated.This field will be removed in a future version. See https://github.com/jakartaee/rest/issues/607 -
name
-
value
-
version
private final int version -
path
-
domain
-
-
Constructor Details
-
Cookie
@Deprecated public Cookie(String name, String value, String path, String domain, int version) throws IllegalArgumentException Deprecated.This constructor will be removed in a future version. Please useCookie.Builderinstead.Create a new instance.- Parameters:
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.- Throws:
IllegalArgumentException- if name isnull.
-
Cookie
@Deprecated public Cookie(String name, String value, String path, String domain) throws IllegalArgumentException Deprecated.This constructor will be removed in a future version. Please useCookie.Builderinstead.Create a new instance.- Parameters:
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.- Throws:
IllegalArgumentException- if name isnull.
-
Cookie
Deprecated.This constructor will be removed in a future version. Please useCookie.Builderinstead.Create a new instance.- Parameters:
name- the name of the cookie.value- the value of the cookie.- Throws:
IllegalArgumentException- if name isnull.
-
Cookie
Create a new instance from the suppliedCookie.AbstractCookieBuilderinstance.- Parameters:
builder- the builder.- Throws:
IllegalArgumentException- ifbuilder.nameisnull.- Since:
- 3.1
-
-
Method Details
-
valueOf
Deprecated.This method will be removed in a future version. Please use RuntimeDelegate.getInstance().createHeaderDelegate(Cookie.class).fromString(value) instead.Creates a new instance ofCookieby parsing the supplied string.- Parameters:
value- the cookie string.- Returns:
- the newly created
Cookie. - Throws:
IllegalArgumentException- if the supplied string cannot be parsed or isnull.
-
getName
-
getValue
-
getVersion
public int getVersion()Get the version of the cookie.- Returns:
- the cookie version.
-
getDomain
-
getPath
-
toString
Deprecated.The format of the toString() method is subject to change in a future version. Please use RuntimeDelegate.getInstance().createHeaderDelegate(Cookie.class).toString(value) instead if you rely on the format of this method.Convert the cookie to a string suitable for use as the value of the corresponding HTTP header. -
hashCode
-
equals
-