(final URL url, final double time)
| 1450 | // because there we are directly replacing the response before loading the response into the window |
| 1451 | // here we are replacing the page in the window (maybe after some time) |
| 1452 | private void processRefresh(final URL url, final double time) throws IOException { |
| 1453 | final WebClient webClient = getWebClient(); |
| 1454 | |
| 1455 | final int refreshLimit = webClient.getOptions().getPageRefreshLimit(); |
| 1456 | if (refreshLimit == 0) { |
| 1457 | final WebResponse webResponse = getWebResponse(); |
| 1458 | throw new FailingHttpStatusCodeException("Too many redirects for " |
| 1459 | + webResponse.getWebRequest().getUrl(), webResponse); |
| 1460 | } |
| 1461 | |
| 1462 | if (refreshLimit >= 0) { |
| 1463 | final StackTraceElement[] elements = new Exception().getStackTrace(); |
| 1464 | int count = 0; |
| 1465 | final int elementCountLimit = refreshLimit > 50 ? 400 : refreshLimit > 10 ? 80 : 5; |
| 1466 | final int elementCount = elements.length; |
| 1467 | |
| 1468 | if (elementCount > elementCountLimit) { |
| 1469 | for (int i = 0; i < elementCount; i++) { |
| 1470 | if ("processRefresh".equals(elements[i].getMethodName()) |
| 1471 | && "org.htmlunit.html.HtmlPage".equals(elements[i].getClassName())) { |
| 1472 | count++; |
| 1473 | if (count >= refreshLimit) { |
| 1474 | final WebResponse webResponse = getWebResponse(); |
| 1475 | throw new FailingHttpStatusCodeException( |
| 1476 | "Too many redirects (>= " + count + ") for " |
| 1477 | + webResponse.getWebRequest().getUrl(), webResponse); |
| 1478 | } |
| 1479 | } |
| 1480 | } |
| 1481 | } |
| 1482 | } |
| 1483 | |
| 1484 | webClient.getRefreshHandler().handleRefresh(this, url, (int) time); |
| 1485 | } |
| 1486 | |
| 1487 | /** |
| 1488 | * Returns an auto-refresh string if specified. This will look in both the meta |
no test coverage detected