Added in API level 9

CookiePolicy

interface CookiePolicy
java.net.CookiePolicy

CookiePolicy implementations decide which cookies should be accepted and which should be rejected. Three pre-defined policy implementations are provided, namely ACCEPT_ALL, ACCEPT_NONE and ACCEPT_ORIGINAL_SERVER.

See RFC 2965 sec. 3.3 and 7 for more detail.

Summary

Public methods
abstract Boolean
shouldAccept(uri: URI!, cookie: HttpCookie!)

Will be called to see whether or not this cookie should be accepted.

Properties
static CookiePolicy!

One pre-defined policy which accepts all cookies.

static CookiePolicy!

One pre-defined policy which accepts no cookies.

static CookiePolicy!

One pre-defined policy which only accepts cookies from original server.

Public methods

shouldAccept

Added in API level 9
abstract fun shouldAccept(
    uri: URI!,
    cookie: HttpCookie!
): Boolean

Will be called to see whether or not this cookie should be accepted.

Parameters
uri URI!: the URI to consult accept policy with
cookie HttpCookie!: the HttpCookie object in question
Return
Boolean true if this cookie should be accepted; otherwise, false

Properties

ACCEPT_ALL

Added in API level 9
static val ACCEPT_ALL: CookiePolicy!

One pre-defined policy which accepts all cookies.

ACCEPT_NONE

Added in API level 9
static val ACCEPT_NONE: CookiePolicy!

One pre-defined policy which accepts no cookies.

ACCEPT_ORIGINAL_SERVER

Added in API level 9
static val ACCEPT_ORIGINAL_SERVER: CookiePolicy!

One pre-defined policy which only accepts cookies from original server.