Esempio n. 1
0
        /// <inheritdoc/>
        public virtual void HandleRequest(Exchange exchange)
        {
            CoapExchange ce = new CoapExchange(exchange, this);

            switch (exchange.Request.Method)
            {
            case Method.GET:
                DoGet(ce);
                break;

            case Method.POST:
                DoPost(ce);
                break;

            case Method.PUT:
                DoPut(ce);
                break;

            case Method.DELETE:
                DoDelete(ce);
                break;

            default:
                break;
            }
        }
Esempio n. 2
0
 /// <inheritdoc/>
 protected override void DoGet(CoapExchange exchange)
 {
     exchange.Respond(StatusCode.Content,
                      LinkFormat.Serialize(_root, exchange.Request.UriQueries),
                      MediaType.ApplicationLinkFormat);
 }
Esempio n. 3
0
 /// <summary>
 /// Handles the DELETE request in the given CoAPExchange.
 /// By default it responds with a 4.05 (Method Not Allowed).
 /// Override this method to respond differently.
 /// The response code to a DELETE request should be a 2.02 (Deleted).
 /// </summary>
 protected virtual void DoDelete(CoapExchange exchange)
 {
     exchange.Respond(StatusCode.MethodNotAllowed);
 }