org.eclipse.californium.core.coap.Request.getDestinationContext()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(265)

本文整理了Java中org.eclipse.californium.core.coap.Request.getDestinationContext方法的一些代码示例,展示了Request.getDestinationContext的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.getDestinationContext方法的具体详情如下:
包路径:org.eclipse.californium.core.coap.Request
类名称:Request
方法名:getDestinationContext

Request.getDestinationContext介绍

暂无

代码示例

代码示例来源:origin: eclipse/leshan

  1. @Override
  2. public void sendRequest(Request request) {
  3. CoapMessageListener listener = listeners.get(toStringAddress(request.getDestinationContext().getPeerAddress()));
  4. if (listener != null) {
  5. listener.trace(new CoapMessage(request, false));
  6. }
  7. }

代码示例来源:origin: eclipse/leshan

  1. public static byte[] serialize(Observation obs) {
  2. JsonObject o = Json.object();
  3. o.set("request", Hex.encodeHexString(serializer.serializeRequest(obs.getRequest()).bytes));
  4. if (obs.getContext() != null)
  5. o.set("peer", EndpointContextSerDes.serialize(obs.getContext()));
  6. else
  7. o.set("peer", EndpointContextSerDes.serialize(obs.getRequest().getDestinationContext()));
  8. if (obs.getRequest().getUserContext() != null) {
  9. JsonObject ctxObject = Json.object();
  10. for (Entry<String, String> e : obs.getRequest().getUserContext().entrySet()) {
  11. ctxObject.set(e.getKey(), e.getValue());
  12. }
  13. o.set("context", ctxObject);
  14. }
  15. return o.toString().getBytes();
  16. }

代码示例来源:origin: org.eclipse.leshan/leshan-server-cluster

  1. public static byte[] serialize(Observation obs) {
  2. JsonObject o = Json.object();
  3. o.set("request", Hex.encodeHexString(serializer.serializeRequest(obs.getRequest()).bytes));
  4. if (obs.getContext() != null)
  5. o.set("peer", EndpointContextSerDes.serialize(obs.getContext()));
  6. else
  7. o.set("peer", EndpointContextSerDes.serialize(obs.getRequest().getDestinationContext()));
  8. if (obs.getRequest().getUserContext() != null) {
  9. JsonObject ctxObject = Json.object();
  10. for (Entry<String, String> e : obs.getRequest().getUserContext().entrySet()) {
  11. ctxObject.set(e.getKey(), e.getValue());
  12. }
  13. o.set("context", ctxObject);
  14. }
  15. return o.toString().getBytes();
  16. }

相关文章