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

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

本文整理了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

public OdlOnem2mCoapRequestPrimitiveBuilder setOperationUpdate() {
  onem2mRequest.coapRequest = Request.newPut();
  return this;
}
public OdlOnem2mCoapRequestPrimitiveBuilder setOperationDelete() {

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

public CC03(String serverURI) {
  super(CC03.class.getSimpleName());
  // create the request
  Request request = Request.newPut();
  // add payload
  request.setPayload("TD_COAP_CORE_03");
  request.getOptions().setContentFormat(MediaTypeRegistry.TEXT_PLAIN);
  // set the parameters and execute the request
  executeRequest(request, serverURI, RESOURCE_URI);
}

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

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

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

/**
 * Sends a PUT request with payload and required Content-Format and blocks
 * until the response is available.
 *
 * @param payload the payload
 * @param format the Content-Format
 * @return the CoAP response
 */
public CoapResponse put(String payload, int format) {
  return synchronous(format(Request.newPut().setURI(uri).setPayload(payload), format));
}

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

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

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

/**
 * Sends a PUT request with the specified payload and the specified content
 * format and invokes the specified handler when a response arrives.
 * 
 * @param handler the Response handler
 * @param payload the payload
 * @param format the Content-Format
 */
public void put(CoapHandler handler, String payload, int format) {
  asynchronous(format(Request.newPut().setURI(uri).setPayload(payload), format), handler);
}

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

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

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

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

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

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

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

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

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

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

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

@Override
public void visit(final UpdateRequest request) {
  if (!areParametersValid(request.getClientParameters())) {
    return;
  }
  coapRequest = Request.newPut();
  buildRequestSettings(request);
  buildLocationPath(request);
  buildRequestContent(request);
  parametersValid = true;
}

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

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

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

@Override
public void visit(final UpdateRequest request) {
  if (!areParametersValid(request.getClientParameters())) {
    return;
  }
  coapRequest = Request.newPut();
  buildRequestSettings(request);
  buildLocationPath(request);
  buildRequestContent(request);
  parametersValid = true;
}

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

@Override
public void visit(WriteAttributesRequest request) {
  coapRequest = Request.newPut();
  setTarget(coapRequest, request.getPath());
  for (String query : request.getAttributes().toQueryParams()) {
    coapRequest.getOptions().addUriQuery(query);
  }
}

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

@Override
public void visit(WriteAttributesRequest request) {
  coapRequest = Request.newPut();
  setTarget(coapRequest, destination, request.getPath());
  for (String query : request.getObserveSpec().toQueryParams()) {
    coapRequest.getOptions().addUriQuery(query);
  }
}

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

@Override
public void visit(BootstrapWriteRequest request) {
  coapRequest = Request.newPut();
  coapRequest.setConfirmable(true);
  ContentFormat format = request.getContentFormat();
  coapRequest.getOptions().setContentFormat(format.getCode());
  coapRequest.setPayload(encoder.encode(request.getNode(), format, request.getPath(), model));
  setTarget(coapRequest, request.getPath());
}

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

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

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

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

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

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

相关文章