本文整理汇总了Java中com.ning.http.client.HttpResponseStatus.getStatusCode方法的典型用法代码示例。如果您正苦于以下问题:Java HttpResponseStatus.getStatusCode方法的具体用法?Java HttpResponseStatus.getStatusCode怎么用?Java HttpResponseStatus.getStatusCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.ning.http.client.HttpResponseStatus
的用法示例。
在下文中一共展示了HttpResponseStatus.getStatusCode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onStatusReceived
import com.ning.http.client.HttpResponseStatus; //导入方法依赖的package包/类
public com.ning.http.client.AsyncHandler.STATE onStatusReceived(
HttpResponseStatus responseStatus) throws Exception {
int statusCode = responseStatus.getStatusCode();
testCaseReport.setResponseStatusCode(statusCode);
if (statusCode != testCase.getExpectedResCode()) {
testCaseReport.setError("Expected status code ["+testCase.getExpectedResCode()
+"] does not match actual status code ["+statusCode+"]");
testCaseReport.setStatus(TestStatus.Failed.status);
testCaseReport.setFailureReason(TestFailureReason.InvalidStatusCode.status);
if(testCase.isAbortOnInvalidStatusCode())
{
return STATE.ABORT;
}
}
builder.accumulate(responseStatus);
return STATE.CONTINUE;
}
示例2: onStatusReceived
import com.ning.http.client.HttpResponseStatus; //导入方法依赖的package包/类
@Override
public STATE onStatusReceived(HttpResponseStatus responseStatus) throws Exception {
if (log.isTraceEnabled()) {
log.trace("{} onStatusReceived {}", exchange.getExchangeId(), responseStatus);
}
try {
statusCode = responseStatus.getStatusCode();
statusText = responseStatus.getStatusText();
getEndpoint().getBinding().onStatusReceived(getEndpoint(), exchange, responseStatus);
} catch (Exception e) {
exchange.setException(e);
}
return STATE.CONTINUE;
}