public static SecurityResource Deserialise(Request request) { SecurityResource result = null; string name = request.UriPaths.Last(); if (!string.IsNullOrEmpty(name) && (request.ContentType == TlvConstant.CONTENT_TYPE_TLV)) { result = new SecurityResource(name); using (TlvReader reader = new TlvReader(request.Payload)) { result.Deserialise(reader); } } return(result); }
protected override void DoPut(CoapExchange exchange) { SecurityResource securityResource = SecurityResource.Deserialise(exchange.Request); if (securityResource == null) { Response response = Response.CreateResponse(exchange.Request, StatusCode.BadRequest); exchange.Respond(response); } else { this.Add(securityResource); Response response = Response.CreateResponse(exchange.Request, StatusCode.Changed); exchange.Respond(response); } }
public static SecurityResource Deserialise(Request request) { SecurityResource result = null; string name = request.UriPaths.Last(); if (!string.IsNullOrEmpty(name) && (request.ContentType == TlvConstant.CONTENT_TYPE_TLV)) { result = new SecurityResource(name); using (TlvReader reader = new TlvReader(request.Payload)) { result.Deserialise(reader); } } return result; }