Class BasicClientCookie
- All Implemented Interfaces:
Serializable,Cloneable,Cookie,SetCookie
SetCookie.- Since:
- 4.0
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionCookie attributes as specified by the origin serverprivate StringDomain attribute.private InstantExpirationInstant.private StringPath attribute.private Instantprivate booleanThehttpOnlyflag.private booleanMy secure flag.private final StringCookie nameprivate static final longprivate StringCookie valueFields inherited from interface org.apache.hc.client5.http.cookie.Cookie
DOMAIN_ATTR, EXPIRES_ATTR, HTTP_ONLY_ATTR, MAX_AGE_ATTR, PATH_ATTR, SECURE_ATTR -
Constructor Summary
ConstructorsConstructorDescriptionBasicClientCookie(String name, String value) Default Constructor taking a name and a value. -
Method Summary
Modifier and TypeMethodDescriptionclone()booleancontainsAttribute(String name) getAttribute(String name) Deprecated.Returns creation time of the cookie.Returns domain attribute of the cookie.Deprecated.Returns the expirationInstantof the cookie, ornullif none exists.getName()Returns the name.getPath()Returns the path attribute of the cookiegetValue()Returns the value.booleanReturns true if this cookie has expired.booleanDeprecated.booleanChecks whether this Cookie has been marked ashttpOnly.booleanReturnsfalseif the cookie should be discarded at the end of the "session";trueotherwise.booleanisSecure()Indicates whether this cookie requires a secure connection.booleanremoveAttribute(String name) voidsetAttribute(String name, String value) voidsetCreationDate(Instant creationDate) voidsetCreationDate(Date creationDate) Deprecated.voidSets the domain attribute.voidsetExpiryDate(Instant expiryInstant) Sets expiration date.voidsetExpiryDate(Date expiryDate) Deprecated.Use {setExpiryDate(Instant)}voidsetHttpOnly(boolean httpOnly) Sets the http-only attribute of the cookie.voidSets the path attribute.voidsetSecure(boolean secure) Sets the secure attribute of the cookie.voidSets the valuetoString()
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
name
Cookie name -
attribs
Cookie attributes as specified by the origin server -
value
Cookie value -
cookieDomain
Domain attribute. -
cookieExpiryDate
ExpirationInstant. -
cookiePath
Path attribute. -
isSecure
private boolean isSecureMy secure flag. -
creationDate
-
httpOnly
private boolean httpOnlyThehttpOnlyflag.
-
-
Constructor Details
-
BasicClientCookie
Default Constructor taking a name and a value. The value may be null.- Parameters:
name- The name.value- The value.
-
-
Method Details
-
getName
Returns the name. -
getValue
Returns the value. -
setValue
Sets the value -
getExpiryDate
Deprecated.Returns the expirationDateof the cookie, ornullif none exists.Note: the object returned by this method is considered immutable. Changing it (e.g. using setTime()) could result in undefined behaviour. Do so at your peril.
- Specified by:
getExpiryDatein interfaceCookie- Returns:
- Expiration
Date, ornull. - See Also:
-
getExpiryInstant
Returns the expirationInstantof the cookie, ornullif none exists.Note: the object returned by this method is considered immutable. Changing it (e.g. using setTime()) could result in undefined behaviour. Do so at your peril.
- Specified by:
getExpiryInstantin interfaceCookie- Returns:
- Expiration
Instant, ornull.
-
setExpiryDate
Deprecated.Use {setExpiryDate(Instant)}Sets expiration date.Note: the object returned by this method is considered immutable. Changing it (e.g. using setTime()) could result in undefined behaviour. Do so at your peril.
- Specified by:
setExpiryDatein interfaceSetCookie- Parameters:
expiryDate- theDateafter which this cookie is no longer valid.- See Also:
-
setExpiryDate
Sets expiration date.Note: the object returned by this method is considered immutable. Changing it (e.g. using setTime()) could result in undefined behaviour. Do so at your peril.
- Specified by:
setExpiryDatein interfaceSetCookie- Parameters:
expiryInstant- theInstantafter which this cookie is no longer valid.- Since:
- 5.2
- See Also:
-
isPersistent
public boolean isPersistent()Returnsfalseif the cookie should be discarded at the end of the "session";trueotherwise.- Specified by:
isPersistentin interfaceCookie- Returns:
falseif the cookie should be discarded at the end of the "session";trueotherwise
-
getDomain
Returns domain attribute of the cookie. -
setDomain
Sets the domain attribute. -
getPath
Returns the path attribute of the cookie -
setPath
Sets the path attribute. -
isSecure
public boolean isSecure()Description copied from interface:CookieIndicates whether this cookie requires a secure connection. -
setSecure
public void setSecure(boolean secure) Sets the secure attribute of the cookie.When
truethe cookie should only be sent using a secure protocol (https). This should only be set when the cookie's originating server used a secure protocol to set the cookie's value. -
setHttpOnly
public void setHttpOnly(boolean httpOnly) Sets the http-only attribute of the cookie.- Specified by:
setHttpOnlyin interfaceSetCookie- Parameters:
httpOnly- true if this cookie is to be marked ashttpOnly, false otherwise- Since:
- 5.2
-
isExpired
Deprecated.Returns true if this cookie has expired. -
isExpired
Returns true if this cookie has expired. -
getCreationDate
Deprecated.UsegetCreationInstant().Description copied from interface:CookieReturns creation time of the cookie.- Specified by:
getCreationDatein interfaceCookie- Since:
- 4.4
-
getCreationInstant
Description copied from interface:CookieReturns creation time of the cookie.- Specified by:
getCreationInstantin interfaceCookie- Since:
- 5.2
-
isHttpOnly
public boolean isHttpOnly()Description copied from interface:CookieChecks whether this Cookie has been marked ashttpOnly.The default implementation returns
false.- Specified by:
isHttpOnlyin interfaceCookie- Returns:
- true if this Cookie has been marked as
httpOnly, false otherwise - Since:
- 5.2
- See Also:
-
setCreationDate
Deprecated.- Since:
- 4.4
-
setCreationDate
- Since:
- 5.2
-
setAttribute
-
getAttribute
- Specified by:
getAttributein interfaceCookie
-
containsAttribute
- Specified by:
containsAttributein interfaceCookie
-
removeAttribute
- Since:
- 4.4
-
clone
- Overrides:
clonein classObject- Throws:
CloneNotSupportedException
-
toString
-
getCreationInstant().