Modifier and Type | Field and Description |
---|---|
private java.net.CookieHandler |
cookieHandler |
NO_COOKIES
Constructor and Description |
---|
JavaNetCookieJar(java.net.CookieHandler cookieHandler) |
Modifier and Type | Method and Description |
---|---|
private java.util.List<Cookie> |
decodeHeaderAsJavaNetCookies(HttpUrl url,
java.lang.String header)
Convert a request header to OkHttp's cookies via
HttpCookie . |
java.util.List<Cookie> |
loadForRequest(HttpUrl url)
Load cookies from the jar for an HTTP request to
url . |
void |
saveFromResponse(HttpUrl url,
java.util.List<Cookie> cookies)
Saves
cookies from an HTTP response to this store according to this jar's policy. |
public void saveFromResponse(HttpUrl url, java.util.List<Cookie> cookies)
CookieJar
cookies
from 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, cookies
contains only the trailer's
cookies.
saveFromResponse
in interface CookieJar
public java.util.List<Cookie> loadForRequest(HttpUrl url)
CookieJar
url
. 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
.
loadForRequest
in interface CookieJar
private java.util.List<Cookie> decodeHeaderAsJavaNetCookies(HttpUrl url, java.lang.String header)
HttpCookie
. That extra step handles
multiple cookies in a single request header, which Cookie.parse(okhttp3.HttpUrl, java.lang.String)
doesn't support.