Example usage for java.net CookieStore toString

List of usage examples for java.net CookieStore toString

Introduction

In this page you can find the example usage for java.net CookieStore toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:net.qiujuer.common.okhttp.Http.java

public static String getCookie() {
    CookieHandler handler = getClient().getCookieHandler();
    if (handler != null && handler instanceof CookieManager) {
        CookieManager manager = (CookieManager) handler;
        CookieStore store = manager.getCookieStore();
        if (store != null) {
            Util.log(store.toString());
            try {
                List<HttpCookie> cookies = store.getCookies();
                if (cookies.size() > 0) {
                    String cookieStr = "";
                    for (HttpCookie cookie : cookies) {
                        cookieStr += cookie.toString();
                    }/*w ww . j a  v  a2 s .  c o  m*/
                    return cookieStr;
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
    return "";
}