本文整理汇总了Java中org.springframework.http.HttpStatus.equals方法的典型用法代码示例。如果您正苦于以下问题:Java HttpStatus.equals方法的具体用法?Java HttpStatus.equals怎么用?Java HttpStatus.equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.http.HttpStatus
的用法示例。
在下文中一共展示了HttpStatus.equals方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: assert200andReturnTrueOr404andReturnFalse
import org.springframework.http.HttpStatus; //导入方法依赖的package包/类
public static boolean assert200andReturnTrueOr404andReturnFalse(
ResponseEntity<?> response) {
HttpStatus status = response.getStatusCode();
assertThat(status, anyOf(equalTo(HttpStatus.OK),
equalTo(HttpStatus.NOT_FOUND)));
return status.equals(HttpStatus.OK);
}
示例2: removeSingleAgent
import org.springframework.http.HttpStatus; //导入方法依赖的package包/类
private void removeSingleAgent(ServerAddress internalAddress, String bindingId) throws ServiceBrokerException {
ServerAddress bindingAddress = new ServerAddress(bindingId, internalAddress.getIp(), internalAddress.getPort());
HttpEntity<ServerAddress> entity = new HttpEntity<>(bindingAddress, headers);
try {
HttpStatus statusCode = restTemplate.exchange(haProxy, HttpMethod.DELETE, entity, Object.class)
.getStatusCode();
if (!statusCode.equals(HttpStatus.NO_CONTENT))
throw new ServiceBrokerException("Could not remove external IP " + internalAddress.getName() + " - "
+ internalAddress.getIp() + ":" + internalAddress.getPort());
} catch (RestClientException e) {
e.printStackTrace();
throw new ServiceBrokerException("Could not remove external IP " + internalAddress.getName() + " - "
+ internalAddress.getIp() + ":" + internalAddress.getPort());
}
}