public class Cookie extends Object implements Serializable
Constructor and Description |
---|
Cookie(org.apache.http.cookie.ClientCookie clientCookie)
Creates a new HtmlUnit cookie from the HttpClient cookie provided.
|
Cookie(String domain,
String name,
String value)
Creates a new cookie with the specified name and value which applies to the specified domain.
|
Cookie(String domain,
String name,
String value,
String path,
Date expires,
boolean secure)
Creates a new cookie with the specified name and value which applies to the specified domain,
the specified path, and expires on the specified date.
|
Cookie(String domain,
String name,
String value,
String path,
Date expires,
boolean secure,
boolean httpOnly)
Creates a new cookie with the specified name and value which applies to the specified domain,
the specified path, and expires on the specified date.
|
Cookie(String domain,
String name,
String value,
String path,
Date expires,
boolean secure,
boolean httpOnly,
String sameSite)
Creates a new cookie with the specified name and value which applies to the specified domain,
the specified path, and expires on the specified date.
|
Cookie(String domain,
String name,
String value,
String path,
int maxAge,
boolean secure)
Creates a new cookie with the specified name and value which applies to the specified domain,
the specified path, and expires after the specified amount of time.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
String |
getDomain()
Returns the domain to which this cookie applies (
null for all domains). |
Date |
getExpires()
Returns the date on which this cookie expires (
null if it never expires). |
String |
getName()
Returns the cookie name.
|
String |
getPath()
Returns the path to which this cookie applies (
null for all paths). |
String |
getSameSite() |
String |
getValue()
Returns the cookie value.
|
int |
hashCode() |
boolean |
isHttpOnly()
Returns whether or not this cookie is HttpOnly (i.e. not available in JS).
|
boolean |
isSecure()
Returns whether or not this cookie is secure (i.e.
|
org.apache.http.cookie.Cookie |
toHttpClient()
Converts this cookie to an HttpClient cookie.
|
String |
toString() |
public Cookie(String domain, String name, String value)
domain
- the domain to which this cookie appliesname
- the cookie namevalue
- the cookie namepublic Cookie(String domain, String name, String value, String path, Date expires, boolean secure)
domain
- the domain to which this cookie appliesname
- the cookie namevalue
- the cookie namepath
- the path to which this cookie appliesexpires
- the date on which this cookie expiressecure
- whether or not this cookie is secure (i.e. HTTPS vs HTTP)public Cookie(String domain, String name, String value, String path, Date expires, boolean secure, boolean httpOnly)
domain
- the domain to which this cookie appliesname
- the cookie namevalue
- the cookie namepath
- the path to which this cookie appliesexpires
- the date on which this cookie expiressecure
- whether or not this cookie is secure (i.e. HTTPS vs HTTP)httpOnly
- whether or not this cookie should be only used for HTTP(S) headerspublic Cookie(String domain, String name, String value, String path, Date expires, boolean secure, boolean httpOnly, String sameSite)
domain
- the domain to which this cookie appliesname
- the cookie namevalue
- the cookie namepath
- the path to which this cookie appliesexpires
- the date on which this cookie expiressecure
- whether or not this cookie is secure (i.e. HTTPS vs HTTP)httpOnly
- whether or not this cookie should be only used for HTTP(S) headerssameSite
- the sameSite attributepublic Cookie(org.apache.http.cookie.ClientCookie clientCookie)
clientCookie
- the HttpClient cookiepublic Cookie(String domain, String name, String value, String path, int maxAge, boolean secure)
domain
- the domain to which this cookie appliesname
- the cookie namevalue
- the cookie namepath
- the path to which this cookie appliesmaxAge
- the number of seconds for which this cookie is valid; -1
indicates that the
cookie should never expire; other negative numbers are not allowedsecure
- whether or not this cookie is secure (i.e. HTTPS vs HTTP)public String getName()
public String getValue()
public String getDomain()
null
for all domains).null
for all domains)public String getPath()
null
for all paths).null
for all paths)public Date getExpires()
null
if it never expires).null
if it never expires)public boolean isSecure()
public boolean isHttpOnly()
public String getSameSite()
null
if not set.public org.apache.http.cookie.Cookie toHttpClient()
Copyright © 2002–2024 Gargoyle Software Inc.. All rights reserved.