private void checkRecursion() { final StackTraceElement[] elements = new Exception().getStackTrace(); if (elements.length > 500) { for (int i = 0; i < 500; i++) { if (!elements[i].getClassName().startsWith("com.gargoylesoftware.htmlunit.")) { return; } } final WebResponse webResponse = getWebResponse(); throw new FailingHttpStatusCodeException("Too much redirect for " + webResponse.getWebRequest().getUrl(), webResponse); } }
private void checkRecursion() { final StackTraceElement[] elements = new Exception().getStackTrace(); if (elements.length > 500) { for (int i = 0; i < 500; i++) { if (!elements[i].getClassName().startsWith("com.gargoylesoftware.htmlunit.")) { return; } } final WebResponse webResponse = getWebResponse(); throw new FailingHttpStatusCodeException("Too much redirect for " + webResponse.getWebRequest().getUrl(), webResponse); } }
/** * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span> * * <p>Throws a {@link FailingHttpStatusCodeException} if the request's status code indicates a request * failure and {@link #isThrowExceptionOnFailingStatusCode()} returns <tt>true</tt>. * * @param webResponse the response which may trigger a {@link FailingHttpStatusCodeException} */ public void throwFailingHttpStatusCodeExceptionIfNecessary(final WebResponse webResponse) { final int statusCode = webResponse.getStatusCode(); final boolean successful = (statusCode >= HttpStatus.SC_OK && statusCode < HttpStatus.SC_MULTIPLE_CHOICES) || statusCode == HttpStatus.SC_USE_PROXY || statusCode == HttpStatus.SC_NOT_MODIFIED; if (isThrowExceptionOnFailingStatusCode() && !successful) { throw new FailingHttpStatusCodeException(webResponse); } }
/** * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span> * * <p>Throws a {@link FailingHttpStatusCodeException} if the request's status code indicates a request * failure and {@link #isThrowExceptionOnFailingStatusCode()} returns <tt>true</tt>. * * @param webResponse the response which may trigger a {@link FailingHttpStatusCodeException} */ public void throwFailingHttpStatusCodeExceptionIfNecessary(final WebResponse webResponse) { final int statusCode = webResponse.getStatusCode(); final boolean successful = (statusCode >= HttpStatus.SC_OK && statusCode < HttpStatus.SC_MULTIPLE_CHOICES) || statusCode == HttpStatus.SC_USE_PROXY || statusCode == HttpStatus.SC_NOT_MODIFIED; if (isThrowExceptionOnFailingStatusCode() && !successful) { throw new FailingHttpStatusCodeException(webResponse); } }
/** * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span> * * <p>Throws a {@link FailingHttpStatusCodeException} if the request's status code indicates a request * failure and {@link #isThrowExceptionOnFailingStatusCode()} returns <tt>true</tt>. * * @param webResponse the response which may trigger a {@link FailingHttpStatusCodeException} */ public void throwFailingHttpStatusCodeExceptionIfNecessary(final WebResponse webResponse) { final int statusCode = webResponse.getStatusCode(); final boolean successful = (statusCode >= HttpStatus.SC_OK && statusCode < HttpStatus.SC_MULTIPLE_CHOICES) || statusCode == HttpStatus.SC_USE_PROXY || statusCode == HttpStatus.SC_NOT_MODIFIED; if (isThrowExceptionOnFailingStatusCode() && !successful) { throw new FailingHttpStatusCodeException(webResponse); } }
/** * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span> * * <p>Throws a {@link FailingHttpStatusCodeException} if the request's status code indicates a request * failure and {@link WebClientOptions#isThrowExceptionOnFailingStatusCode()} returns {@code true}. * * @param webResponse the response which may trigger a {@link FailingHttpStatusCodeException} */ public void throwFailingHttpStatusCodeExceptionIfNecessary(final WebResponse webResponse) { final int statusCode = webResponse.getStatusCode(); final boolean successful = (statusCode >= HttpStatus.SC_OK && statusCode < HttpStatus.SC_MULTIPLE_CHOICES) || statusCode == HttpStatus.SC_USE_PROXY || statusCode == HttpStatus.SC_NOT_MODIFIED; if (getOptions().isThrowExceptionOnFailingStatusCode() && !successful) { throw new FailingHttpStatusCodeException(webResponse); } }
/** * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span> * * <p>Throws a {@link FailingHttpStatusCodeException} if the request's status code indicates a request * failure and {@link WebClientOptions#isThrowExceptionOnFailingStatusCode()} returns {@code true}. * * @param webResponse the response which may trigger a {@link FailingHttpStatusCodeException} */ public void throwFailingHttpStatusCodeExceptionIfNecessary(final WebResponse webResponse) { final int statusCode = webResponse.getStatusCode(); final boolean successful = (statusCode >= HttpStatus.SC_OK && statusCode < HttpStatus.SC_MULTIPLE_CHOICES) || statusCode == HttpStatus.SC_USE_PROXY || statusCode == HttpStatus.SC_NOT_MODIFIED; if (getOptions().isThrowExceptionOnFailingStatusCode() && !successful) { throw new FailingHttpStatusCodeException(webResponse); } }
throw new FailingHttpStatusCodeException("Too much redirect for " + webResponse.getWebRequest().getUrl(), webResponse);
throw new FailingHttpStatusCodeException("Too much redirect for " + webResponse.getWebRequest().getUrl(), webResponse);