java getRequesetHeader(“设置Cookie”)获取null为什么?

java getRequesetHeader(“设置Cookie”)获取null为什么?,java,http,cookies,Java,Http,Cookies,这是我的代码,我想打印cookies的消息: PostMethod post = new PostMethod("http://www.zhihu.com/login"); if ((statusCode == HttpStatus.SC_MOVED_TEMPORARILY) || (statusCode == HttpStatus.SC_MOVED_PERMANENTLY) || (statusCode == HttpStatus.SC_SEE_OTHER)

这是我的代码,我想打印cookies的消息:

PostMethod post = new PostMethod("http://www.zhihu.com/login");
if ((statusCode == HttpStatus.SC_MOVED_TEMPORARILY)
        || (statusCode == HttpStatus.SC_MOVED_PERMANENTLY)
        || (statusCode == HttpStatus.SC_SEE_OTHER)
        || (statusCode == HttpStatus.SC_TEMPORARY_REDIRECT)) {
    for (Header header : post.getResponseHeaders()) {
        System.out.println(header.getName() + "----"
                + header.getValue());
    }
    System.out.println("header print");
}
System.out.println(post.getRequestHeader("Set-Cookie"));
打印标头时效果很好,但可以打印cookie的标头

这是打印的信息:

Location----/
Pragma----no-cache
Cache-Control----private, no-store, max-age=0, no-cache, must-revalidate,      post-check=0, pre-check=0
Set-Cookie----q_c; Domain=; expires=Sun, 25 Jun 2017 ; Path=/
Set-Cookie----q_c0="NTA5NWRkYTJiNmU0OGZiZDU1MjE2YmZiYjEwMzBiOGF8UzBPWXFyckpacHpQNDJ5eQ==";Domain=; httponly; Path=/
Set-Cookie----c_c=; Domain=; expires=Wed, 26 Jun GMT; Path=/
Set-Cookie----r_i=; Domain=; expires=Wed, 26 Jun GMT; Path=/
Set-Cookie----sinaid=; Domain=; expires=Wed, 26 Jun  GMT; Path=/
header print
null

Cookie的HTTP请求标头字段是Cookie,而不是用于HTTP响应的Set Cookie