public Tcre2(MyRespone Rec1Respone, MyRespone homeRespone) { String traceId = homeRespone.getHttpClientContext().getResponse().getFirstHeader("traceid").getValue(); qid = traceId.substring(traceId.length() - 19); lid = qid; Document doc = Jsoup.parse(EntityReader.ReadeEntity(homeRespone.getBhe(), "utf8")); ssid = "&ssid=" + doc.select("#login").attr("href").split("ssid")[1].split("&bd_p")[0]; plus_lvs = doc.select("#index-card").attr("data-lsversion"); r = System.currentTimeMillis() + ""; getCookieFromHome(homeRespone); getCookieFromTr1(Rec1Respone); }
private void getCookieFromHome(MyRespone myRespone) { Header[] headers = myRespone.getHttpClientContext().getResponse().getHeaders("Set-Cookie"); for (Header header : headers) { if (!header.getValue().contains("__bsi")) { BasicClientCookie cookie = new BasicClientCookie( header.getValue().split(";")[0].split("=")[0], header.getValue().split(";")[0].split("=")[1]); cookie.setDomain(host); cookie.setPath("/"); // System.out.println(cookie); cookieStore.addCookie(cookie); } } }
private void getCookieFromTr1(MyRespone myRespone) { Header[] headers = myRespone.getHttpClientContext().getResponse().getHeaders("Set-Cookie"); for (Header header : headers) { BasicClientCookie cookie = new BasicClientCookie( header.getValue().split(";")[0].split("=")[0], header.getValue().split(";")[0].split("=")[1]); cookie.setDomain(host); cookie.setPath("/"); cookieStore.addCookie(cookie); System.out.println(header.getValue().split(";")[0].split("=")[1]); } BasicClientCookie cookie = new BasicClientCookie("PLUS", "1"); cookie.setDomain(host); cookie.setPath("/"); cookieStore.addCookie(cookie); }