Esempio n. 1
0
        public void Postw(RCRunner runner, RCClosure closure, RCString left, RCString right)
        {
            if (left.Count != 1)
            {
                throw new Exception("postw can only put to one resource at a time.");
            }
            RestAsyncState state = new RestAsyncState(runner,
                                                      closure,
                                                      left[0],
                                                      "POST",
                                                      RCBlock.Empty,
                                                      right,
                                                      false,
                                                      Interlocked.Increment(ref _client),
                                                      _timeout,
                                                      _retry,
                                                      true);

            ThreadPool.QueueUserWorkItem(state.BeginWebRequest, null);
        }
Esempio n. 2
0
        public void Delw(RCRunner runner, RCClosure closure, RCBlock left, RCString right)
        {
            if (right.Count != 1)
            {
                throw new Exception("delw can only get from one resource at a time.");
            }
            RestAsyncState state = new RestAsyncState(runner,
                                                      closure,
                                                      right[0],
                                                      "DELETE",
                                                      left,
                                                      new RCString(),
                                                      false,
                                                      Interlocked.Increment(ref _client),
                                                      _timeout,
                                                      _retry,
                                                      true);

            ThreadPool.QueueUserWorkItem(state.BeginWebRequest, state);
        }
Esempio n. 3
0
        public void Putw(RCRunner runner, RCClosure closure, RCString left, RCBlock right)
        {
            if (left.Count != 1)
            {
                throw new Exception("putw can only put to one resource at a time.");
            }
            RCString       body  = (RCString)right.Get("body");
            RCBlock        head  = (RCBlock)right.Get("head", RCBlock.Empty);
            RestAsyncState state = new RestAsyncState(runner,
                                                      closure,
                                                      left[0],
                                                      "PUT",
                                                      head,
                                                      body,
                                                      false,
                                                      Interlocked.Increment(ref _client),
                                                      _timeout,
                                                      _retry,
                                                      true);

            ThreadPool.QueueUserWorkItem(state.BeginWebRequest, null);
        }