mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-11-19 04:13:18 +01:00
71 lines
2.8 KiB
Java
71 lines
2.8 KiB
Java
package org.apache.http.cookie;
|
|
|
|
import com.amazonaws.auth.policy.internal.JsonDocumentFields;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.Locale;
|
|
import java.util.Map;
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
import org.apache.http.HttpRequest;
|
|
import org.apache.http.annotation.Contract;
|
|
import org.apache.http.annotation.ThreadingBehavior;
|
|
import org.apache.http.config.Lookup;
|
|
import org.apache.http.params.HttpParams;
|
|
import org.apache.http.protocol.HttpContext;
|
|
import org.apache.http.util.Args;
|
|
import rx.Single$$ExternalSyntheticBUOutline0;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
@Contract(threading = ThreadingBehavior.SAFE)
|
|
@Deprecated
|
|
/* loaded from: classes11.dex */
|
|
public final class CookieSpecRegistry implements Lookup<CookieSpecProvider> {
|
|
private final ConcurrentHashMap<String, CookieSpecFactory> registeredSpecs = new ConcurrentHashMap<>();
|
|
|
|
public CookieSpec getCookieSpec(String str, HttpParams httpParams) throws IllegalStateException {
|
|
Args.notNull(str, "Name");
|
|
CookieSpecFactory cookieSpecFactory = this.registeredSpecs.get(str.toLowerCase(Locale.ENGLISH));
|
|
if (cookieSpecFactory != null) {
|
|
return cookieSpecFactory.newInstance(httpParams);
|
|
}
|
|
Single$$ExternalSyntheticBUOutline0.m$2("Unsupported cookie spec: ".concat(str));
|
|
return null;
|
|
}
|
|
|
|
public List<String> getSpecNames() {
|
|
return new ArrayList(this.registeredSpecs.keySet());
|
|
}
|
|
|
|
@Override // org.apache.http.config.Lookup
|
|
public CookieSpecProvider lookup(final String str) {
|
|
return new CookieSpecProvider() { // from class: org.apache.http.cookie.CookieSpecRegistry.1
|
|
@Override // org.apache.http.cookie.CookieSpecProvider
|
|
public CookieSpec create(HttpContext httpContext) {
|
|
return CookieSpecRegistry.this.getCookieSpec(str, ((HttpRequest) httpContext.getAttribute("http.request")).getParams());
|
|
}
|
|
};
|
|
}
|
|
|
|
public void register(String str, CookieSpecFactory cookieSpecFactory) {
|
|
Args.notNull(str, "Name");
|
|
Args.notNull(cookieSpecFactory, "Cookie spec factory");
|
|
this.registeredSpecs.put(str.toLowerCase(Locale.ENGLISH), cookieSpecFactory);
|
|
}
|
|
|
|
public void setItems(Map<String, CookieSpecFactory> map) {
|
|
if (map == null) {
|
|
return;
|
|
}
|
|
this.registeredSpecs.clear();
|
|
this.registeredSpecs.putAll(map);
|
|
}
|
|
|
|
public void unregister(String str) {
|
|
Args.notNull(str, JsonDocumentFields.POLICY_ID);
|
|
this.registeredSpecs.remove(str.toLowerCase(Locale.ENGLISH));
|
|
}
|
|
|
|
public CookieSpec getCookieSpec(String str) throws IllegalStateException {
|
|
return getCookieSpec(str, null);
|
|
}
|
|
}
|