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

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

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

Request.setConfirmable介绍

暂无

代码示例

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

  1. public CC05(String serverURI) {
  2. super(CC05.class.getSimpleName());
  3. // create the request
  4. Request request = Request.newGet();
  5. request.setConfirmable(false);
  6. // set the parameters and execute the request
  7. executeRequest(request, serverURI, RESOURCE_URI);
  8. }

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

  1. public CC06(String serverURI) {
  2. super(CC06.class.getSimpleName());
  3. // create the request
  4. Request request = Request.newDelete();
  5. request.setConfirmable(false);
  6. // set the parameters and execute the request
  7. executeRequest(request, serverURI, RESOURCE_URI);
  8. }

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

  1. public CC09(String serverURI) {
  2. super(CC09.class.getSimpleName());
  3. // create the request
  4. Request request = new Request(Code.GET);
  5. request.setConfirmable(true);
  6. // set the parameters and execute the request
  7. executeRequest(request, serverURI, RESOURCE_URI);
  8. }

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

  1. public CC08(String serverURI) {
  2. super(CC08.class.getSimpleName());
  3. // create the request
  4. Request request = new Request(Code.POST);
  5. request.setConfirmable(false);
  6. // add payload
  7. request.setPayload("TD_COAP_CORE_08");
  8. request.getOptions().setContentFormat(MediaTypeRegistry.TEXT_PLAIN);
  9. // set the parameters and execute the request
  10. executeRequest(request, serverURI, RESOURCE_URI);
  11. }

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

  1. public CC07(String serverURI) {
  2. super(CC07.class.getSimpleName());
  3. // create the request
  4. Request request = new Request(Code.PUT);
  5. request.setConfirmable(false);
  6. // add payload
  7. request.setPayload("TD_COAP_CORE_07");
  8. request.getOptions().setContentFormat(MediaTypeRegistry.TEXT_PLAIN);
  9. // set the parameters and execute the request
  10. executeRequest(request, serverURI, RESOURCE_URI);
  11. }

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

  1. @Override
  2. public void visit(BootstrapDeleteRequest request) {
  3. coapRequest = Request.newDelete();
  4. coapRequest.setConfirmable(true);
  5. EndpointContext context = EndpointContextUtil.extractContext(destination);
  6. coapRequest.setDestinationContext(context);
  7. setTarget(coapRequest, request.getPath());
  8. }

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

  1. @Override
  2. public void visit(BootstrapFinishRequest request) {
  3. coapRequest = Request.newPost();
  4. coapRequest.setConfirmable(true);
  5. EndpointContext context = EndpointContextUtil.extractContext(destination);
  6. coapRequest.setDestinationContext(context);
  7. // root path
  8. if (rootPath != null) {
  9. for (String rootPathPart : rootPath.split("/")) {
  10. if (!StringUtils.isEmpty(rootPathPart)) {
  11. coapRequest.getOptions().addUriPath(rootPathPart);
  12. }
  13. }
  14. }
  15. coapRequest.getOptions().addUriPath("bs");
  16. }

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

  1. postSecurity.getOptions().addUriPath("0");
  2. postSecurity.getOptions().addUriPath(key.toString());
  3. postSecurity.setConfirmable(true);
  4. postSecurity.setDestination(targetAddress);
  5. postSecurity.setDestinationPort(targetPort);

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

  1. postServer.getOptions().addUriPath("1");
  2. postServer.getOptions().addUriPath(key.toString());
  3. postServer.setConfirmable(true);
  4. postServer.setDestination(targetAddress);
  5. postServer.setDestinationPort(targetPort);

代码示例来源:origin: org.eclipse.californium/californium-proxy

  1. outgoingRequest.setConfirmable(type == Type.CON);

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

  1. outgoingRequest.setConfirmable(incomingRequest.getType() == Type.CON);

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

  1. @Override
  2. public void visit(BootstrapWriteRequest request) {
  3. coapRequest = Request.newPut();
  4. coapRequest.setConfirmable(true);
  5. ContentFormat format = request.getContentFormat();
  6. coapRequest.getOptions().setContentFormat(format.getCode());
  7. coapRequest.setPayload(encoder.encode(request.getNode(), format, request.getPath(), model));
  8. setTarget(coapRequest, request.getPath());
  9. }

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

  1. @Test
  2. public void testNonconfirmable() throws Exception {
  3. createSimpleServer();
  4. // send request
  5. Request request = new Request(CoAP.Code.POST);
  6. request.setConfirmable(false);
  7. request.setDestination(InetAddress.getLoopbackAddress());
  8. request.setDestinationPort(serverPort);
  9. request.setPayload("client says hi");
  10. request.send();
  11. System.out.println("client sent request");
  12. // receive response and check
  13. Response response = request.waitForResponse(1000);
  14. assertNotNull("Client received no response", response);
  15. System.out.println("client received response");
  16. assertEquals(response.getPayloadString(), SERVER_RESPONSE);
  17. }

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

  1. Request deleteAll = Request.newDelete();
  2. deleteAll.getOptions().addUriPath("/");
  3. deleteAll.setConfirmable(true);
  4. deleteAll.setDestination(exchange.getSourceAddress());
  5. deleteAll.setDestinationPort(exchange.getSourcePort());

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

  1. @Test
  2. public void testNonConfirmable() throws Exception {
  3. // send request
  4. Request req2acc = new Request(Code.POST);
  5. req2acc.setConfirmable(false);
  6. req2acc.setURI(getUri(ACC_RESOURCE));
  7. req2acc.setPayload("client says hi");
  8. req2acc.send();
  9. // receive response and check
  10. Response response = req2acc.waitForResponse(1000);
  11. assertPayloadIsOfCorrectType(response, SERVER_RESPONSE, Type.NON);
  12. Request req2noacc = new Request(Code.POST);
  13. req2noacc.setConfirmable(false);
  14. req2noacc.setURI(getUri(NO_ACC_RESOURCE));
  15. req2noacc.setPayload("client says hi");
  16. req2noacc.send();
  17. // receive response and check
  18. response = req2noacc.waitForResponse(1000);
  19. assertPayloadIsOfCorrectType(response, SERVER_RESPONSE, Type.NON);
  20. }

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

  1. @Test
  2. public void testConfirmable() throws Exception {
  3. // send request
  4. Request req2acc = new Request(Code.POST);
  5. req2acc.setConfirmable(true);
  6. req2acc.setURI(getUri(ACC_RESOURCE));
  7. req2acc.setPayload("client says hi");
  8. req2acc.send();
  9. // receive response and check
  10. Response response = req2acc.waitForResponse(1000);
  11. assertPayloadIsOfCorrectType(response, SERVER_RESPONSE, Type.CON);
  12. Request req2noacc = new Request(Code.POST);
  13. req2noacc.setConfirmable(true);
  14. req2noacc.setURI(getUri(NO_ACC_RESOURCE));
  15. req2noacc.setPayload("client says hi");
  16. req2noacc.send();
  17. // receive response and check
  18. response = req2noacc.waitForResponse(1000);
  19. assertPayloadIsOfCorrectType(response, SERVER_RESPONSE, Type.ACK);
  20. }

相关文章