本文整理了Java中org.eclipse.californium.core.coap.OptionSet.getETagCount()
方法的一些代码示例,展示了OptionSet.getETagCount()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OptionSet.getETagCount()
方法的具体详情如下:
包路径:org.eclipse.californium.core.coap.OptionSet
类名称:OptionSet
方法名:getETagCount
[英]Returns the number of ETag options.
[中]返回ETag选项的数量。
代码示例来源:origin: eclipse/californium
/**
* Checks for ETag option.
*
* @param response
* the response
* @return true, if successful
*/
protected boolean hasEtag(Response response) {
// boolean success = response.hasOption(OptionNumberRegistry.ETAG);
boolean success = response.getOptions().getETagCount() > 0;
if (!success) {
System.out.println("FAIL: Response without Etag");
} else {
System.out.printf(
"PASS: Etag (%s)\n",
Utils.toHexString(response.getOptions().getETags()
.get(0)));
}
return success;
}
代码示例来源:origin: eclipse/californium
protected final void appendEtags(final OptionSet options) {
if (options != null && options.getETagCount() > 0) {
buffer.append(", ETags(");
int i = 0;
for (byte[] tag : options.getETags()) {
buffer.append(Utils.toHexString(tag));
if (++i < options.getETagCount()) {
buffer.append(", ");
}
}
buffer.append(")");
}
}
protected final void appendRequestDetails(final Request request) {
代码示例来源:origin: eclipse/californium
@Override
public void check(final Response response) {
assertTrue("Response has no ETag", response.getOptions().getETagCount() > 0);
Object obj = storage.get(var);
assertThat("Object stored under " + var + " is not an ETag", obj, is(instanceOf(byte[].class)));
assertThat("Response contains wrong ETag", (byte[]) obj,
is(response.getOptions().getETags().get(0)));
}
});
代码示例来源:origin: eclipse/californium
@Override
public void check(final Response response) {
assertTrue("Response has no ETag", response.getOptions().getETagCount() > 0);
storage.put(var, response.getOptions().getETags().get(0));
}
});
代码示例来源:origin: eclipse/californium
System.out.println("---------------\nGET /validate\n---------------");
response = client.get();
if (response.getOptions().getETagCount()==1) {
etag = response.getOptions().getETags().get(0);
System.out.println(response.getCode() + " - ETag [" + Utils.toHexString(etag) + "]");
System.out.println("---------------\nGET /validate with If-Match\n---------------");
response = client.get();
if (response.getOptions().getETagCount()==1) {
etag = response.getOptions().getETags().get(0);
System.out.println(response.getCode() + " - ETag [" + Utils.toHexString(etag) + "]");
内容来源于网络,如有侵权,请联系作者删除!