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

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

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

Request.newPut介绍

[英]Convenience factory method to construct a PUT request and equivalent to new Request(Code.PUT);
[中]构造PUT请求的便利工厂方法,等价于new Request(Code.PUT);

代码示例

代码示例来源:origin: org.opendaylight.iotdm/onem2mbenchmark-impl

  1. public OdlOnem2mCoapRequestPrimitiveBuilder setOperationUpdate() {
  2. onem2mRequest.coapRequest = Request.newPut();
  3. return this;
  4. }
  5. public OdlOnem2mCoapRequestPrimitiveBuilder setOperationDelete() {

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

  1. public CC03(String serverURI) {
  2. super(CC03.class.getSimpleName());
  3. // create the request
  4. Request request = Request.newPut();
  5. // add payload
  6. request.setPayload("TD_COAP_CORE_03");
  7. request.getOptions().setContentFormat(MediaTypeRegistry.TEXT_PLAIN);
  8. // set the parameters and execute the request
  9. executeRequest(request, serverURI, RESOURCE_URI);
  10. }

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

  1. public CB03(String serverURI) {
  2. super(CB03.class.getSimpleName());
  3. Request request = Request.newPut();
  4. request.setPayload(data);
  5. request.getOptions().setContentFormat(MediaTypeRegistry.TEXT_PLAIN);
  6. // set the parameters and execute the request
  7. executeRequest(request, serverURI, "/large-update");
  8. }

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

  1. /**
  2. * Sends a PUT request with payload and required Content-Format and blocks
  3. * until the response is available.
  4. *
  5. * @param payload the payload
  6. * @param format the Content-Format
  7. * @return the CoAP response
  8. */
  9. public CoapResponse put(String payload, int format) {
  10. return synchronous(format(Request.newPut().setURI(uri).setPayload(payload), format));
  11. }

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

  1. /**
  2. * Sends a PUT request with payload and required Content-Format and blocks
  3. * until the response is available.
  4. *
  5. * @param payload the payload
  6. * @param format the Content-Format
  7. * @return the CoAP response
  8. */
  9. public CoapResponse put(byte[] payload, int format) {
  10. return synchronous(format(Request.newPut().setURI(uri).setPayload(payload), format));
  11. }

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

  1. /**
  2. * Sends a PUT request with the specified payload and the specified content
  3. * format and invokes the specified handler when a response arrives.
  4. *
  5. * @param handler the Response handler
  6. * @param payload the payload
  7. * @param format the Content-Format
  8. */
  9. public void put(CoapHandler handler, String payload, int format) {
  10. asynchronous(format(Request.newPut().setURI(uri).setPayload(payload), format), handler);
  11. }

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

  1. /**
  2. * Sends a PUT request with the specified payload and the specified content
  3. * format and invokes the specified handler when a response arrives.
  4. *
  5. * @param handler the Response handler
  6. * @param payload the payload
  7. * @param format the Content-Format
  8. */
  9. public void put(CoapHandler handler, byte[] payload, int format) {
  10. asynchronous(format(Request.newPut().setURI(uri).setPayload(payload), format), handler);
  11. }

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

  1. /**
  2. * Sends a PUT request with the If-None-Match option set and blocks until
  3. * the response is available.
  4. *
  5. * @param payload the payload string
  6. * @param format the Content-Format
  7. * @return the CoAP response
  8. */
  9. public CoapResponse putIfNoneMatch(String payload, int format) {
  10. return synchronous(ifNoneMatch(format(Request.newPut().setURI(uri).setPayload(payload), format)));
  11. }

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

  1. /**
  2. *
  3. * @param handler the Response handler
  4. * @param payload the payload
  5. * @param format the Content-Format
  6. * @param etags the ETags for the If-Match option
  7. */
  8. public void putIfMatch(CoapHandler handler, String payload, int format, byte[] ... etags) {
  9. asynchronous(ifMatch(format(Request.newPut().setURI(uri).setPayload(payload), format), etags), handler);
  10. }

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

  1. /**
  2. * Sends a PUT request with with the specified ETags in the If-Match option
  3. * and blocks until the response is available.
  4. *
  5. * @param payload the payload
  6. * @param format the Content-Format
  7. * @param etags the ETags for the If-Match option
  8. * @return the CoAP response
  9. */
  10. public CoapResponse putIfMatch(byte[] payload, int format, byte[] ... etags) {
  11. return synchronous(ifMatch(format(Request.newPut().setURI(uri).setPayload(payload), format), etags));
  12. }

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

  1. /**
  2. * Sends a PUT request with the If-None-Match option set and blocks until
  3. * the response is available.
  4. *
  5. * @param payload the payload
  6. * @param format the Content-Format
  7. * @return the CoAP response
  8. */
  9. public CoapResponse putIfNoneMatch(byte[] payload, int format) {
  10. return synchronous(ifNoneMatch(format(Request.newPut().setURI(uri).setPayload(payload), format)));
  11. }

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

  1. @Override
  2. public void visit(final UpdateRequest request) {
  3. if (!areParametersValid(request.getClientParameters())) {
  4. return;
  5. }
  6. coapRequest = Request.newPut();
  7. buildRequestSettings(request);
  8. buildLocationPath(request);
  9. buildRequestContent(request);
  10. parametersValid = true;
  11. }

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

  1. /**
  2. *
  3. * @param handler the Response handler
  4. * @param payload the payload
  5. * @param format the Content-Format
  6. * @param etags the ETags for the If-Match option
  7. */
  8. public void putIfMatch(CoapHandler handler, byte[] payload, int format, byte[] ... etags) {
  9. asynchronous(ifMatch(format(Request.newPut().setURI(uri).setPayload(payload), format), etags), handler);
  10. }

代码示例来源:origin: org.github.leshan/leshan-client

  1. @Override
  2. public void visit(final UpdateRequest request) {
  3. if (!areParametersValid(request.getClientParameters())) {
  4. return;
  5. }
  6. coapRequest = Request.newPut();
  7. buildRequestSettings(request);
  8. buildLocationPath(request);
  9. buildRequestContent(request);
  10. parametersValid = true;
  11. }

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

  1. @Override
  2. public void visit(WriteAttributesRequest request) {
  3. coapRequest = Request.newPut();
  4. setTarget(coapRequest, request.getPath());
  5. for (String query : request.getAttributes().toQueryParams()) {
  6. coapRequest.getOptions().addUriQuery(query);
  7. }
  8. }

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

  1. @Override
  2. public void visit(WriteAttributesRequest request) {
  3. coapRequest = Request.newPut();
  4. setTarget(coapRequest, destination, request.getPath());
  5. for (String query : request.getObserveSpec().toQueryParams()) {
  6. coapRequest.getOptions().addUriQuery(query);
  7. }
  8. }

代码示例来源: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/leshan

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

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

  1. private static Request newBlockwiseRequest(final int bodySize, final int blockSize) {
  2. Request request = Request.newPut();
  3. request.getOptions().setBlock1(BlockOption.size2Szx(blockSize), true, 0).setSize1(bodySize);
  4. request.setPayload(generateRandomPayload(blockSize));
  5. return request;
  6. }
  7. }

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

  1. @Override
  2. public void visit(WriteRequest request) {
  3. coapRequest = request.isReplaceRequest() ? Request.newPut() : Request.newPost();
  4. coapRequest.getOptions().setContentFormat(request.getContentFormat().getCode());
  5. coapRequest
  6. .setPayload(LwM2mNodeEncoder.encode(request.getNode(), request.getContentFormat(), request.getPath()));
  7. setTarget(coapRequest, destination, request.getPath());
  8. }

相关文章