From 164498339d60b2b06aa32c19e6d9753572a2e8b4 Mon Sep 17 00:00:00 2001 From: "Christian P. MOMON" Date: Sat, 3 Jul 2021 19:55:38 +0200 Subject: [PATCH] Added cookie manager for uptime survey. --- src/fr/devinsy/statoolinfos/uptime/UptimeSurveyor.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/fr/devinsy/statoolinfos/uptime/UptimeSurveyor.java b/src/fr/devinsy/statoolinfos/uptime/UptimeSurveyor.java index 2d5d03a..a10806a 100644 --- a/src/fr/devinsy/statoolinfos/uptime/UptimeSurveyor.java +++ b/src/fr/devinsy/statoolinfos/uptime/UptimeSurveyor.java @@ -19,6 +19,8 @@ package fr.devinsy.statoolinfos.uptime; import java.io.IOException; +import java.net.CookieHandler; +import java.net.CookieManager; import java.net.HttpURLConnection; import java.net.URL; import java.util.concurrent.ExecutorService; @@ -93,7 +95,7 @@ public class UptimeSurveyor if ((result == 301) || (result == 302) || (result == 307) || (result == 308)) { - System.out.println("BOUND DETECTED " + currentURL.toString() + " -> " + location); + System.out.println(Thread.currentThread().getId() + " BOUND DETECTED " + currentURL.toString() + " -> " + location); currentURL = new URL(location); currentBound += 1; @@ -153,6 +155,11 @@ public class UptimeSurveyor } */ + // + CookieManager cookieManager = new CookieManager(); + CookieHandler.setDefault(cookieManager); + + // ExecutorService pool = Executors.newFixedThreadPool(20); for (Uptime uptime : result) {