以下有关Cookie的问题需要帮助
谢谢。
答案 0 :(得分:1)
您的Java应用程序将需要创建一个cookie存储并将其链接到HttpClient。例如
CookieStore cookieStore = new BasicCookieStore();
// Populate cookies if needed
BasicClientCookie cookie = new BasicClientCookie("name", "value");
cookie.setDomain(".mycompany.com");
cookie.setPath("/");
cookieStore.addCookie(cookie);
// Set the store
CloseableHttpClient httpclient = HttpClients.custom()
.setDefaultCookieStore(cookieStore)
.build();
参考:https://hc.apache.org/httpcomponents-client-ga/tutorial/html/statemgmt.html