Forms 无法使用jsoup通过登录页面

Forms 无法使用jsoup通过登录页面,forms,apache,jsoup,Forms,Apache,Jsoup,我无法使用jsoup登录并刮取引用的页面以获得所需的响应 我正在尝试访问名为https://localhost/private/frontpage.do,我可以看到POST方法是POST security\u check,我通过firebug收集到它的参数password=guest&username=guest&submit= 当我使用下面的代码时,我仍然无法到达所需的页面 Response res = Jsoup .connect("https://localhost

我无法使用jsoup登录并刮取引用的页面以获得所需的响应

我正在尝试访问名为
https://localhost/private/frontpage.do
,我可以看到POST方法是
POST security\u check
,我通过firebug收集到它的参数
password=guest&username=guest&submit=

当我使用下面的代码时,我仍然无法到达所需的页面

Response res = Jsoup
            .connect("https://localhost/private/security_check")
            .data("j_username", "guest")
            .data("j_password", "guest")
            .referrer("https://localhost/private/frontpage.do")
            .data("submit", "")
            .method(Method.POST)
            .execute();
Document doc = res.parse();

    String sessionId = res.cookie("SESSIONID");

    Document doc2 = Jsoup.connect("https://localhost/private/frontpage.do")
            .cookie("SESSIONID", sessionId)
            .get();
我从firebug收到了以下帖子位置和参数,如下
https://localhost/private/j_security_check?password=guest&username=guest&submit=


你知道为什么我看不到新页面,而是在线程“main”org.jsoup.HttpStatusException中的Java
Exception中得到一个HTTP错误吗?HTTP error fetching URL。Status=408

在firebug中找到的URL看起来像是在使用GET。你确定该方法应该是POST吗?网络规范显示了
POST SECURITY\u CHECK
,所以我猜这就是POST方法。