我遇到了同样的问题,并且使用了与问题类似的方法,但是没有运气。对我来说起作用的是为每个复制的cookie添加域。(BasicClientcookie
cookie.setDomain(String))
public static BasiccookieStore getcookieStore(String cookies, String domain) { String[] cookievalues = cookies.split(";"); BasiccookieStore cs = new BasiccookieStore(); BasicClientcookie cookie; for (int i = 0; i < cookievalues.length; i++) { String[] split = cookievalues[i].split("="); if (split.length == 2) cookie = new BasicClientcookie(split[0], split[1]); else cookie = new BasicClientcookie(split[0], null); cookie.setDomain(domain); cs.addcookie(cookie); } return cs;} String cookies = cookieManager.getInstance().getcookie(url); BasiccookieStore lCS = getcookieStore(cookies, MyApp.sDomain); HttpContext localContext = new BasicHttpContext(); DefaultHttpClient httpclient = new DefaultHttpClient(); httpclient.setcookieStore(lCS); localContext.setAttribute(ClientContext.cookie_STORE, lCS); ...
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)