Package org.cef.network
Class CefCookieManager
- java.lang.Object
-
- org.cef.network.CefCookieManager
-
public abstract class CefCookieManager extends java.lang.Object
Class used for managing cookies. The methods of this class may be called on any thread unless otherwise indicated.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract boolean
deleteCookies(java.lang.String url, java.lang.String cookieName)
Delete all cookies that match the specified parameters.abstract void
dispose()
Removes the native reference from an unused object.protected void
finalize()
abstract boolean
flushStore(CefCompletionCallback handler)
Flush the backing store (if any) to disk.static CefCookieManager
getGlobalManager()
Returns the global cookie manager.abstract boolean
setCookie(java.lang.String url, CefCookie cookie)
Sets a cookie given a valid URL and explicit user-provided cookie attributes.abstract void
setSupportedSchemes(java.util.Vector<java.lang.String> schemes, boolean includeDefaults)
Set the schemes supported by this manager.abstract boolean
visitAllCookies(CefCookieVisitor visitor)
Visit all cookies.abstract boolean
visitUrlCookies(java.lang.String url, boolean includeHttpOnly, CefCookieVisitor visitor)
Visit a subset of cookies.
-
-
-
Method Detail
-
finalize
protected void finalize() throws java.lang.Throwable
- Throws:
java.lang.Throwable
-
getGlobalManager
public static final CefCookieManager getGlobalManager()
Returns the global cookie manager. By default data will be stored at CefSettings.cache_path if specified or in memory otherwise.- Returns:
- The global cookie manager.
-
dispose
public abstract void dispose()
Removes the native reference from an unused object.
-
setSupportedSchemes
public abstract void setSupportedSchemes(java.util.Vector<java.lang.String> schemes, boolean includeDefaults)
Set the schemes supported by this manager. Calling this method with an empty |schemes| value and |includeDefaults| set to false will disable all loading and saving of cookies for this manager. Must be called before any cookies are accessed.- Parameters:
schemes
- List of supported schemes.includeDefaults
- If true the default schemes ("http", "https", "ws" and "wss") will also be supported.
-
visitAllCookies
public abstract boolean visitAllCookies(CefCookieVisitor visitor)
Visit all cookies. The returned cookies are ordered by longest path, then by earliest creation date.- Parameters:
visitor
- Callback that will receive cookies on the UI thread.- Returns:
- False if cookies cannot be accessed.
-
visitUrlCookies
public abstract boolean visitUrlCookies(java.lang.String url, boolean includeHttpOnly, CefCookieVisitor visitor)
Visit a subset of cookies. The returned cookies are ordered by longest path, then by earliest creation date.- Parameters:
url
- Results are filtered by the given url scheme, host, domain and path.includeHttpOnly
- If true HTTP-only cookies will also be included in the results.visitor
- Callback that will receive cookies on the UI thread.- Returns:
- False if cookies cannot be accessed.
-
setCookie
public abstract boolean setCookie(java.lang.String url, CefCookie cookie)
Sets a cookie given a valid URL and explicit user-provided cookie attributes. This function expects each attribute to be well-formed. It will check for disallowed characters (e.g. the ';' character is disallowed within the cookie value attribute) and fail without setting the cookie if such characters are found.- Parameters:
url
- The cookie URL.cookie
- The cookie attributes.- Returns:
- False if an invalid URL is specified or if cookies cannot be accessed.
-
deleteCookies
public abstract boolean deleteCookies(java.lang.String url, java.lang.String cookieName)
Delete all cookies that match the specified parameters. If both |url| and |cookieName| values are specified all host and domain cookies matching both will be deleted. If only |url| is specified all host cookies (but not domain cookies) irrespective of path will be deleted. If |url| is empty all cookies for all hosts and domains will be deleted. Cookies can alternately be deleted using the visit*Cookies() methods.- Parameters:
url
- The cookie URL to delete or null.cookieName
- The cookie name to delete or null.- Returns:
- False if a non-empty invalid URL is secified or if cookies cannot be accessed.
-
flushStore
public abstract boolean flushStore(CefCompletionCallback handler)
Flush the backing store (if any) to disk.- Parameters:
handler
- Callback that will be executed on the UI thread upon completion.- Returns:
- False if cookies cannot be accessed.
-
-