示例#1
0
 public StatResult stat(string bucket, string key)
 {
     StatResult statResult = null;
     string url = string.Format("{0}{1}", Config.RS_HOST, statOp(bucket, key));
     string token = Auth.createManageToken(url, null, this.mac);
     HttpManager httpManager = new HttpManager();
     httpManager.setAuthHeader(token);
     httpManager.CompletionHandler = new CompletionHandler(delegate(ResponseInfo respInfo, string response)
     {
         if (respInfo.isOk())
         {
             statResult = StringUtils.jsonDecode<StatResult>(response);
         }
         else
         {
             statResult = new StatResult();
         }
         statResult.Response = response;
         statResult.ResponseInfo = respInfo;
     });
     httpManager.get(url);
     return statResult;
 }
示例#2
0
        public StatResult stat(string bucket, string key)
        {
            StatResult statResult = null;
            string statUrl = string.Format("{0}{1}", Config.ZONE.RsHost, statOp(bucket, key));
            string accessToken = Auth.createManageToken(statUrl, null, this.mac);

            Dictionary<string, string> statHeaders = new Dictionary<string, string>();
            statHeaders.Add("Authorization", accessToken);
            CompletionHandler statCompletionHandler = new CompletionHandler(delegate(ResponseInfo respInfo, string response)
            {
                if (respInfo.isOk())
                {
                    statResult = StringUtils.jsonDecode<StatResult>(response);
                }
                else
                {
                    statResult = new StatResult();
                }
                statResult.Response = response;
                statResult.ResponseInfo = respInfo;
            });

            this.mHttpManager.get(statUrl, statHeaders, statCompletionHandler);
            return statResult;
        }