Example usage for java.net CookieHandler get

List of usage examples for java.net CookieHandler get

Introduction

In this page you can find the example usage for java.net CookieHandler get.

Prototype

public abstract Map<String, List<String>> get(URI uri, Map<String, List<String>> requestHeaders)
        throws IOException;

Source Link

Document

Gets all the applicable cookies from a cookie cache for the specified uri in the request header.

Usage

From source file:com.example.administrator.datarequest.ningworld.HttpHeaders.java

@Override
public void addCookie(URI uri, CookieHandler cookieHandler) {
    try {//from   w w w .j a v a2s.  c o m
        Map<String, List<String>> diskCookies = cookieHandler.get(uri, new HashMap<String, List<String>>());
        for (Map.Entry<String, List<String>> entry : diskCookies.entrySet()) {
            String key = entry.getKey();
            List<String> value = entry.getValue();
            if ((Headers.HEAD_KEY_COOKIE.equalsIgnoreCase(key)
                    || Headers.HEAD_KEY_COOKIE2.equalsIgnoreCase(key))) {
                add(key, TextUtils.join("; ", value));
            }
        }
    } catch (IOException e) {
        Logger.e(e);
    }
}

From source file:com.yolanda.nohttp.HttpHeaders.java

@Override
public void addCookie(URI uri, CookieHandler cookieHandler) {
    try {/*from  w  w w.j a va  2 s  .  com*/
        Map<String, List<String>> diskCookies = cookieHandler.get(uri, new HashMap<String, List<String>>());
        for (Map.Entry<String, List<String>> entry : diskCookies.entrySet()) {
            String key = entry.getKey();
            List<String> value = entry.getValue();
            if ((HEAD_KEY_COOKIE.equalsIgnoreCase(key) || HEAD_KEY_COOKIE2.equalsIgnoreCase(key))) {
                add(key, TextUtils.join("; ", value));
            }
        }
    } catch (IOException e) {
        Logger.e(e);
    }
}

From source file:com.yanzhenjie.nohttp.HttpHeaders.java

@Override
public void addCookie(URI uri, CookieHandler cookieHandler) {
    try {//  w w  w.  j  av  a  2  s  .com
        Map<String, List<String>> diskCookies = cookieHandler.get(uri, new HashMap<String, List<String>>());
        for (Map.Entry<String, List<String>> entry : diskCookies.entrySet()) {
            String key = entry.getKey();
            List<String> value = entry.getValue();
            if (HEAD_KEY_COOKIE.equalsIgnoreCase(key)) {
                add(key, TextUtils.join("; ", value));
            }
        }
    } catch (IOException e) {
        Logger.e(e);
    }
}