本文整理了Java中org.eclipse.californium.core.coap.OptionSet.hasIfNoneMatch()
方法的一些代码示例,展示了OptionSet.hasIfNoneMatch()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OptionSet.hasIfNoneMatch()
方法的具体详情如下:
包路径:org.eclipse.californium.core.coap.OptionSet
类名称:OptionSet
方法名:hasIfNoneMatch
[英]Checks if the If-None-Match option is present.
[中]检查是否存在“如果不匹配”选项。
代码示例来源:origin: eclipse/californium
@Override
public void handlePUT(CoapExchange exchange) {
// Check: Type, Code, has Content-Type
if (exchange.getRequestOptions().hasIfNoneMatch()) {
exchange.respond(PRECONDITION_FAILED);
} else {
exchange.respond(CHANGED);
}
}
代码示例来源:origin: eclipse/californium
if (etag_list != null) for (byte[] value:etag_list)
options.add(new Option(OptionNumberRegistry.ETAG, value));
if (hasIfNoneMatch())
options.add(new Option(OptionNumberRegistry.IF_NONE_MATCH));
if (hasUriPort())
代码示例来源:origin: org.eclipse.californium/californium-core
if (etag_list != null) for (byte[] value:etag_list)
options.add(new Option(OptionNumberRegistry.ETAG, value));
if (hasIfNoneMatch())
options.add(new Option(OptionNumberRegistry.IF_NONE_MATCH));
if (hasUriPort())
代码示例来源:origin: eclipse/californium
@Override
public void handlePUT(CoapExchange exchange) {
if (data!=null && exchange.getRequestOptions().hasIfNoneMatch()) {
exchange.respond(PRECONDITION_FAILED);
// automatically reset
data = null;
} else {
if (exchange.getRequestOptions().hasContentFormat()) {
storeData(exchange.getRequestPayload(), exchange.getRequestOptions().getContentFormat());
exchange.respond(CREATED);
} else {
exchange.respond(BAD_REQUEST, "Content-Format not set");
}
}
}
代码示例来源:origin: eclipse/californium
@Override
public void handlePUT(CoapExchange exchange) {
if (exchange.getRequestOptions().isIfMatch(etag)) {
if (exchange.getRequestOptions().hasContentFormat()) {
storeData(exchange.getRequestPayload(), exchange.getRequestOptions().getContentFormat());
exchange.setETag(etag.clone());
exchange.respond(CHANGED);
} else {
exchange.respond(BAD_REQUEST, "Content-Format not set");
}
} else if (exchange.getRequestOptions().hasIfNoneMatch() && data==null) {
storeData(exchange.getRequestPayload(), exchange.getRequestOptions().getContentFormat());
exchange.respond(CREATED);
} else {
exchange.respond(PRECONDITION_FAILED);
// automatically change now
storeData(null, UNDEFINED);
}
}
内容来源于网络,如有侵权,请联系作者删除!