如何通过aliexpress使用JAVA URLconnection获取所有cookie

时间:2017-07-18 18:55:12

标签: java cookies urlconnection

我尝试获取浏览器中的所有Cookie。我用了这段代码:

    public static void main(String[] args) {
    try {
        URLConnection connection = new URL("https://aliexpress.com/").openConnection();
        List<String> cookies = connection.getHeaderFields().get("Set-Cookie");
        System.out.println(cookies.toString());
    } catch (IOException e) {
        e.printStackTrace();
    }
}

但浏览器有:

"name": "__utma",
"name": "__utmc",
"name": "__utmz",
"name": "_ga",
"name": "_gid", 
"name": "_hvn_login",  
"name": "_ym_isad",    
"name": "_ym_uid",  
"name": "acs_usuc_t",
"name": "aep_common_f",
"name": "aep_usuc_f",
"name": "aeu_cid",
"name": "ali_apache_id",   
"name": "ali_apache_track",  
"name": "ali_apache_tracktmp",
"name": "ali_beacon_id",  
"name": "cna"
"name": "intl_common_forever",
"name": "intl_locale",
"name": "isg"
"name": "xman_f"
"name": "xman_t",
"name": "xman_us_f",
"name": "_mle_tmp0",
"name": "_uab_collina", 
"name": "_umdata",
"name": "JSESSIONID"  

代码只返回

[aep_usuc_f=site=rus&b_locale=ru_RU; Expires=Fri, 16 Jul 2027 18:25:05 GMT; Path=/; Domain=.aliexpress.com]

我如何获得所有其他饼干?这可能吗?

0 个答案:

没有答案