okhttp 处理cookie问题。

为什么80%的码农都做不了架构师?>>>   hot3.png

        builder.cookieJar(new CookieJar() {
            private final HashMap> cookieStore = new HashMap<>();
            @Override
            public void saveFromResponse(HttpUrl url, List cookies) {
                cookieStore.put(url.host(), cookies);
            }

            @Override
            public List loadForRequest(HttpUrl url) {
                List cookies = cookieStore.get(url.host());
                return cookies != null ? cookies : new ArrayList();
            }
        });

转载于:https://my.oschina.net/zdglf/blog/3022093

你可能感兴趣的:(okhttp 处理cookie问题。)