package com.company;
import org.jsoup.Connection;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Element;
import java.io.IOException;
import java.net.*;
import java.util.Map;
public class Parser {
private String viewState;
private String eventValidation;
Map<String, String> cookies;
public void login() throws IOException {
String url = "http://www.aogc2.state.ar.us:8080/DWClient/";
CookieHandler.setDefault(new CookieManager());
Connection connection = Jsoup.connect(url + "Login.aspx");
updateViewState(connection);
try {
Connection.Response res = connection
.data("DWC$DWMessages", "")
.data("__VIEWSTATE", viewState)
.data("__EVENTVALIDATION", eventValidation)
.data("DWC_NotificationToolTip_ClientState", "")
.data("LoginWebPart$LoginTypes", "Guest")
.data("LoginWebPart$TextBoxUserName", "")
.data("LoginWebPart$TextBoxPassword", "")
.data("LoginWebPart$ButtonLogin", "Login")
.data("LoginWebPart_LanguageContextMenu_ClientState","")
.method(Connection.Method.POST)
.execute();
cookies = connection.request().cookies();
System.out.println(cookies);
} catch (IOException ex) {
ex.printStackTrace();
System.exit(1);
}
}
}
这是打印的Cookie列表
{AspxAutoDetectCookieSupport=1, 11f5b7bb-885f-4c81-808d-7d5ae64248f1=DWSessionLoginID=6251bf1c-010f-4219-9a2f-5846d8f77907}
这被描述为一个httpOnly cookie。我怎么能得到它?