com.studerw.tda.http.cookie.CookieJarImpl Maven / Gradle / Ivy
package com.studerw.tda.http.cookie;
import com.studerw.tda.http.cookie.store.CookieStore;
import okhttp3.Cookie;
import okhttp3.CookieJar;
import okhttp3.HttpUrl;
import java.util.List;
public class CookieJarImpl implements CookieJar {
private CookieStore cookieStore;
public CookieJarImpl(CookieStore cookieStore) {
if (cookieStore == null) throw new IllegalArgumentException("Cookie store cannot be null");
this.cookieStore = cookieStore;
}
@Override
public synchronized void saveFromResponse(HttpUrl url, List cookies) {
cookieStore.add(url, cookies);
}
@Override
public synchronized List loadForRequest(HttpUrl url) {
return cookieStore.get(url);
}
public CookieStore getCookieStore() {
return cookieStore;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy