接口 CookieJar
As policy, implementations of this interface are responsible for selecting which cookies to accept and which to reject. A reasonable policy is to reject all cookies, though that may interfere with session-based authentication schemes that require cookies.
As persistence, implementations of this interface must also provide storage of cookies. Simple implementations may store cookies in memory; sophisticated ones may use the file system or database to hold accepted cookies. The cookie storage model specifies policies for updating and expiring cookies.
-
字段概要
字段 -
方法概要
修饰符和类型方法说明loadForRequest(HttpUrl url) Load cookies from the jar for an HTTP request tourl.voidsaveFromResponse(HttpUrl url, List<Cookie> cookies) Savescookiesfrom an HTTP response to this store according to this jar's policy.
-
字段详细资料
-
NO_COOKIES
A cookie jar that never accepts any cookies.
-
-
方法详细资料
-
saveFromResponse
Savescookiesfrom an HTTP response to this store according to this jar's policy.Note that this method may be called a second time for a single HTTP response if the response includes a trailer. For this obscure HTTP feature,
cookiescontains only the trailer's cookies. -
loadForRequest
Load cookies from the jar for an HTTP request tourl. This method returns a possibly empty list of cookies for the network request.Simple implementations will return the accepted cookies that have not yet expired and that match
url.
-