示例#1
0
  /*
   * PUTs content to this resource. PUT is a periodic request from the
   * node to update the lifetime.
   */
  @Override
  public void handlePUT(CoapExchange exchange) {

    if (lifetimeTimer != null) {
      lifetimeTimer.cancel();
    }
    if (validationTimer != null) {
      validationTimer.cancel();
    }

    setParameters(exchange.advanced().getRequest());

    // complete the request
    exchange.respond(ResponseCode.CHANGED);
  }
示例#2
0
 /*
  * DELETEs this node resource
  */
 @Override
 public void handleDELETE(CoapExchange exchange) {
   delete();
   exchange.respond(ResponseCode.DELETED);
 }
示例#3
0
  @Override
  public void handleGET(CoapExchange exchange) {

    exchange.setMaxAge(5);
    exchange.respond(CONTENT, time, TEXT_PLAIN);
  }
示例#4
0
 /*
  * GET only debug return endpoint identifier
  */
 @Override
 public void handleGET(CoapExchange exchange) {
   exchange.setMaxAge((int) Math.max((expiryTime - System.currentTimeMillis()) / 1000, 0));
   exchange.respond(
       ResponseCode.CONTENT, endpointIdentifier + "." + domain, MediaTypeRegistry.TEXT_PLAIN);
 }
示例#5
0
文件: PathSub.java 项目: pluskmk12/cf
 @Override
 public void handleGET(CoapExchange exchange) {
   exchange.respond(this.getURI());
 }