本文整理了Java中com.gargoylesoftware.htmlunit.WebClient.isThrowExceptionOnFailingStatusCode()
方法的一些代码示例,展示了WebClient.isThrowExceptionOnFailingStatusCode()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebClient.isThrowExceptionOnFailingStatusCode()
方法的具体详情如下:
包路径:com.gargoylesoftware.htmlunit.WebClient
类名称:WebClient
方法名:isThrowExceptionOnFailingStatusCode
[英]Returns true if an exception will be thrown in the event of a failing response code.
[中]如果响应代码失败时将引发异常,则返回true。
代码示例来源:origin: org.jenkins-ci/htmlunit
/**
* <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);
}
}
代码示例来源:origin: net.disy.htmlunit/htmlunit
/**
* <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);
}
}
代码示例来源:origin: org.jvnet.hudson/htmlunit
/**
* <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);
}
}
内容来源于网络,如有侵权,请联系作者删除!