原文地址:HttpClient4 警告: Invalid cookie header 的问题解决
最近使用HttpClient4的时候出现如下警告信息
org.apache.http.client.protocol.ResponseProcessCookies processCookies
警告: Invalid cookie header: "set-cookie: ld=ApO1Byllll23mj1xlllll9$cay9lllllT$PxWyllll9lllllVklll5@@@@@@@@@@; path=/; expires=Thu, 22 Oct 2009 01:48:49 GMT; domain=.shanhe114.com". Unable to parse expires attribute: Thu, 22 Oct 2009 01:48:49 GMT
找了很久终于找到解决办法,实际很简单 就是加上这样一句代码
import org.apache.http.client.params.HttpClientParams; import org.apache.http.client.params.CookiePolicy; HttpClient httpClient = new DefaultHttpClient(); HttpClientParams.setCookiePolicy(httpClient.getParams(), CookiePolicy.BROWSER_COMPATIBILITY);