HttpConnection.Responce
いただければ幸いです
try {
Response response = Jsoup.connect("https://account.mojang.com/migrate").execute(); //downloads site to get the cookies
String auth = response.body();
String auth2 = auth.split("name=\"authenticityToken\" value=\"")[1];
auth = auth2.split("\">")[0];
Map<String, String> cookies = response.cookies();
Connection connection = Jsoup.connect("https://account.mojang.com/migrate").data("action", "/migrate/check")
.data("authenticityToken", auth)
.data("mcusername", "username")
.data("password", "password")
.method(Method.POST)
.followRedirects(true);
for (Entry<String, String> cookie : cookies.entrySet()) {
connection.cookie(cookie.getKey(), cookie.getValue());
}
connection.execute(); //exception thrown here
Document document = connection.get();
String docHtml = document.html();
System.out.println(docHtml);
} catch (Exception e) {
e.printStackTrace();
}
を使用していたコードは20 あなたの実行は、この制限を超え、そうにIOExceptionがスローされたに等しいMAX_REDIRECTS
定数を持っています。
リダイレクトの無限ループで接続が滞っているようです。データを転記する方法を変更してみてください。
EDIT リダイレクト後のすべての新しいページに302のステータスコードがあります。だから問題は多分あなたの要求です。
奇妙なことに、私はリダイレクトループが発生していません。彼の要求は間違っていましたが、「私のためには404だけです。 –