java.lang.Object
org.htmlunit.httpclient.HtmlUnitSameSiteCookieStore
- All Implemented Interfaces:
org.apache.http.client.CookieStore
public final class HtmlUnitSameSiteCookieStore
extends Object
implements org.apache.http.client.CookieStore
A
CookieStore used for one request; returns only the cookies that are allowed
by their SameSite attribute (all other operations are delegated).
Like the browsers, for a cross-site request
- 'None' cookies are always sent (they are secure, see
HtmlUnitSameSiteHandler) - 'Strict' cookies are never sent
- 'Lax' cookies are only sent for top-level navigations with a safe method (e.g. GET)
- cookies without (or with an invalid) SameSite attribute are handled as 'Lax'; additionally they are sent for top-level navigations with an unsafe method (e.g. POST) within two minutes after they were created (Lax-allowing-unsafe)
- Author:
- Ronald Brill
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionHtmlUnitSameSiteCookieStore(org.apache.http.client.CookieStore delegate, boolean topLevelNavigation, boolean safeMethod) Ctor. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCookie(org.apache.http.cookie.Cookie cookie) voidclear()booleanclearExpired(Date date) List<org.apache.http.cookie.Cookie>Returns the cookies that are allowed to be sent with this cross-site request.
-
Constructor Details
-
HtmlUnitSameSiteCookieStore
public HtmlUnitSameSiteCookieStore(org.apache.http.client.CookieStore delegate, boolean topLevelNavigation, boolean safeMethod) Ctor.- Parameters:
delegate- the cookie store providing all cookiestopLevelNavigation- whether the (cross-site) request is a top-level navigationsafeMethod- whether the request uses a safe method (GET, HEAD, OPTIONS, TRACE)
-
-
Method Details
-
addCookie
public void addCookie(org.apache.http.cookie.Cookie cookie) - Specified by:
addCookiein interfaceorg.apache.http.client.CookieStore
-
getCookies
Returns the cookies that are allowed to be sent with this cross-site request.- Specified by:
getCookiesin interfaceorg.apache.http.client.CookieStore
-
clearExpired
- Specified by:
clearExpiredin interfaceorg.apache.http.client.CookieStore
-
clear
public void clear()- Specified by:
clearin interfaceorg.apache.http.client.CookieStore
-