Class CefriumCookieManager

java.lang.Object
com.cefrium.CefriumCookieManager

@CefriumExperimental public final class CefriumCookieManager extends Object
The cookies of one CefriumProfile, from CefriumProfile.getCookieManager(). Like android.webkit.CookieManager, with the same Set-Cookie syntax, but per profile and asynchronous: each method returns at once and calls its callback on the UI thread. Callable from any thread.
  • Method Details

    • setCookie

      public void setCookie(String url, String setCookie, Consumer<Boolean> done)
      Sets a cookie for url from a Set-Cookie value, e.g. "id=42; Max-Age=3600; Path=/; Secure; HttpOnly; SameSite=Lax". Expires, Max-Age (which wins), Domain, Path, Secure, HttpOnly and SameSite are read; without an expiry it is a session cookie. done gets whether the engine accepted it (it refuses, for example, SameSite=None without Secure); it may be null.
      Throws:
      IllegalArgumentException - if the value has no name=value
    • getCookie

      public void getCookie(String url, Consumer<String> result)
      The cookies url would send, as a Cookie header: "a=1; b=2".
    • getCookies

      public void getCookies(String url, Consumer<List<CefriumCookie>> result)
      The cookies url would send; with a null or empty URL, every cookie.
    • removeCookies

      public void removeCookies(String url, String name, Consumer<Integer> done)
      Removes the cookies of url, only those named name when it is not null. done gets how many were removed; it may be null.
    • removeAllCookies

      public void removeAllCookies(Consumer<Integer> done)
      Removes every cookie of the profile. done gets how many; it may be null.
    • flush

      public void flush(Runnable done)
      Writes the cookies to disk now rather than later; done may be null.