• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# RequestData类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中RequestData的典型用法代码示例。如果您正苦于以下问题:C# RequestData类的具体用法?C# RequestData怎么用?C# RequestData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



RequestData类属于命名空间,在下文中一共展示了RequestData类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: AddListen

 public void AddListen(String Request, RequestData rd)
 {
     modelData md = new modelData();
     md.Request = Request;
     md.rd = rd;
     listmode.Add(md);
 }
开发者ID:yang190637133,项目名称:communication,代码行数:7,代码来源:_base_Helper.cs


示例2: Request

        public Task<ResponseData> Request(RequestData request, CancellationToken token)
        {
            this.EnsureIsRunning();

            var requestId = this.NextId();

            var callback = new TaskCompletionSource<ResponseData>();
            this.requestCallbacks[requestId] = callback;

            Task.Run(() =>
            {
                var zmqRequest = new ZmqRequest(requestId, request);
                var zmqRequestBytes = zmqRequest.ToBinary();

                this.requestsQueue.TryAdd(zmqRequestBytes);
            });

            if (token != CancellationToken.None)
            {
                token.Register(() =>
                {
                    TaskCompletionSource<ResponseData> _;
                    this.requestCallbacks.TryRemove(requestId, out _);
                });
            }

            return callback.Task;
        }
开发者ID:yonglehou,项目名称:ServiceProxy,代码行数:28,代码来源:ZmqClient.cs


示例3: GetSitecoreData

        private RequestData GetSitecoreData()
        {
            var data = new RequestData();

            data.Add(DataKey.Request, GetRequest());
            data.Add(DataKey.Diagnostics, GetDiagnostics());
            data.Add(DataKey.PageMode, GetPageMode());
            data.Add(DataKey.Culture, GetCulture());
            data.Add(DataKey.Language, GetLanguage());
            data.Add(DataKey.Domain, GetDomain());
            data.Add(DataKey.Device, GetDevice());
            data.Add(DataKey.User, GetUser());
            data.Add(DataKey.Database, GetDatabase());
            data.Add(DataKey.Site, GetSite());
            data.Add(DataKey.ItemVisualization, GetItemVisualization());
            data.Add(DataKey.ItemTemplate, GetItemTemplate());
            data.Add(DataKey.Item, GetItem());
            data.Add(DataKey.VersionInfo, GetVersionInfo());
            data.Add(DataKey.License, GetLicense());
            data.Add(DataKey.Services, _serviceClients.ToArray());
            data.Add(DataKey.Controllers, _controllers.ToArray());
            data.Add(DataKey.UserList, _users.ToArray());

            return data;
        }
开发者ID:gitter-badger,项目名称:Sitecore.Glimpse,代码行数:25,代码来源:SitecoreRequest.cs


示例4: AddEqualToDataAttr

        public void AddEqualToDataAttr(IEnumerable<PropertyValidatorResult> propertyValidators, HtmlTag htmlTag, RequestData request)
        {
            var result = propertyValidators.FirstOrDefault(x => x.PropertyValidator is EqualValidator);
            if (result != null)
            {
                var equal = result.PropertyValidator.As<EqualValidator>();
                MessageFormatter formatter = new MessageFormatter()
                    .AppendPropertyName(result.DisplayName)
                    .AppendArgument("ComparisonValue", equal.ValueToCompare);

                string message = formatter.BuildMessage(equal.ErrorMessageSource.GetString());

                if (_msUnobtrusive)
                {
                    htmlTag.Data("val", true);
                    htmlTag.Data("val-equalto", message);
                    if (request.Accessor.PropertyNames.Length > 1)
                        htmlTag.Data("val-equalto-other", request.Id.Replace("_" + request.Accessor.Name, "") + "_" + equal.MemberToCompare.Name);
                    else
                        htmlTag.Data("val-equalto-other", "*." + equal.MemberToCompare.Name);
                }
                else
                {
                    htmlTag.Data("msg-equalto", message);
                    if (request.Accessor.PropertyNames.Length > 1)
                        htmlTag.Data("rule-equalto", "#" + request.Id.Replace("_" + request.Accessor.Name, "") + "_" + equal.MemberToCompare.Name);
                    else
                        htmlTag.Data("rule-equalto", "#" + equal.MemberToCompare.Name);
                }
            }
        }
开发者ID:eByte23,项目名称:SchoStack,代码行数:31,代码来源:FluentValidationHtmlConventions.cs


示例5: ServeWebRequest

 public bool ServeWebRequest(RawRequestData aRawRequest, IWebRequestResponder aResponder)
 {
     string browserClass = aRawRequest.Cookies["xappbrowser"].FirstOrDefault();
     if (String.IsNullOrEmpty(browserClass) &&
         aRawRequest.Path.PathSegments.Count == 0)
     {
         //Console.WriteLine("Serving browser discrimination page.");
         Console.WriteLine("Serve {0} with discriminator.", String.Join("/", aRawRequest.Path.PathSegments));
         aResponder.SendPage("200 OK", PageSource.MakeSourceFromString(StringType.Html, IndexPage));
         return true;
     }
     string userName = aRawRequest.Cookies["xappuser"].FirstOrDefault();
     User user = null;
     if (!String.IsNullOrEmpty(userName))
     {
         iUserList.TryGetUserById(userName, out user);
     }
     RequestData requestData = new RequestData(aRawRequest.Path, aRawRequest.Method, user, browserClass);
     if (user == null)
     {
         Console.WriteLine("Serve {0} from login app.", String.Join("/", aRawRequest.Path.PathSegments));
         return iLoginApp.ServeWebRequest(requestData, aResponder);
     }
     Console.WriteLine("Serve {0} from base app.", String.Join("/", aRawRequest.Path.PathSegments));
     return iBaseApp.ServeWebRequest(requestData, aResponder);
 }
开发者ID:weeble,项目名称:ohos,代码行数:26,代码来源:UserAndBrowserFilter.cs


示例6: Request

        public Task<ResponseData> Request(RequestData request, CancellationToken _)
        {
            var cancellation = new CancellationTokenSource(this.timeout);

            var responseTask = this.client.Request(request, cancellation.Token);

            var completion = new TaskCompletionSource<ResponseData>();

            //when the token reaches timeout, tries to set the timeoutResponse as the result
            //if the responseTask already completed, this is ignored
            cancellation.Token.Register(() => completion.TrySetResult(this.timeoutResponse));

            //when the responseTask completes, tries to apply its exception/result properties as long as the timeout isn't reached
            responseTask.ContinueWith(t =>
            {
                if (!cancellation.IsCancellationRequested)
                {
                    if (responseTask.Exception != null)
                    {
                        completion.TrySetException(responseTask.Exception.InnerException);
                    }
                    else
                    {
                        completion.TrySetResult(responseTask.Result);
                    }
                }
            });

            return completion.Task;
        }
开发者ID:yonglehou,项目名称:ServiceProxy,代码行数:30,代码来源:TimeoutClient.cs


示例7: Execute

        // Remote Handler
        // Key information of interest here is the Parameters array, each
        // entry represents an element of the URI, with element zero being
        // the

        public void Execute(RequestData rdata)
        {
            if (!enabled) return;

            // If we can't relate to what's there, leave it for others.

            if (rdata.Parameters.Length == 0 || rdata.Parameters[PARM_TESTID] != "remote")
                return;

            Rest.Log.DebugFormat("{0} REST Remote handler ENTRY", MsgId);

            // Remove the prefix and what's left are the parameters. If we don't have
            // the parameters we need, fail the request. Parameters do NOT include
            // any supplied query values.

            if (rdata.Parameters.Length > 1)
            {
                switch (rdata.Parameters[PARM_COMMAND].ToLower())
                {
                    case "move" :
                        DoMove(rdata);
                        break;
                    default :
                        DoHelp(rdata);
                        break;
                }
            }
            else
            {
                DoHelp(rdata);
            }
        }
开发者ID:BackupTheBerlios,项目名称:seleon,代码行数:37,代码来源:Remote.cs


示例8: Request

        public Task<ResponseData> Request(RequestData request, CancellationToken token)
        {
            var svc = this.serviceFactory.CreateService(request.Service);
            var responseTask = svc.Process(request);

            return responseTask;
        }
开发者ID:29795113,项目名称:ServiceProxy,代码行数:7,代码来源:SimpleClient.cs


示例9: open

        public void open(JObject options, ICallback callback)
        {
            if (options != null)
            {
                var requestData = new RequestData
                {
                    Title = options.Value<string>("title"),
                    Text = options.Value<string>("share_text"),
                    Url = options.Value<string>("share_URL"),
                };

                if (requestData.Text == null && requestData.Title == null && requestData.Url == null)
                {
                    return;
                }

                RunOnDispatcher(() =>
                {
                    lock (_queue)
                    {
                        _queue.Enqueue(requestData);
                    }

                    try
                    {
                        DataTransferManager.ShowShareUI();
                        callback.Invoke("OK");
                    }
                    catch
                    {
                        callback.Invoke("not_available");
                    }
                });
            }
        }
开发者ID:EstebanFuentealba,项目名称:react-native-share,代码行数:35,代码来源:RNShareModule.cs


示例10: AddEqualToDataAttr

 public void AddEqualToDataAttr(IEnumerable<ValidationAttribute> propertyValidators, HtmlTag htmlTag, RequestData request)
 {
     var equal = propertyValidators.OfType<CompareAttribute>().FirstOrDefault();
     if (equal != null)
     {
         var formatErrorMessage = equal.FormatErrorMessage(request.Accessor.Name);
         if (_msUnobtrusive)
         {
             htmlTag.Data("val", true);
             htmlTag.Data("val-equalto", formatErrorMessage);
             if (request.Accessor.PropertyNames.Length > 1)
             {
                 htmlTag.Data("val-equalto-other", request.Id.Replace("_" + request.Accessor.Name, "") + "_" + equal.OtherProperty);
             }
             else
             {
                 htmlTag.Data("val-equalto-other", "*." + equal.OtherProperty);
             }
         }
         else
         {
             htmlTag.Data("msg-equalto", formatErrorMessage);
             if (request.Accessor.PropertyNames.Length > 1)
                 htmlTag.Data("rule-equalto", "#" + request.Id.Replace("_" + request.Accessor.Name, "") + "_" + equal.OtherProperty);
             else
                 htmlTag.Data("rule-equalto", "#" + equal.OtherProperty);
         }
     }
 }
开发者ID:eByte23,项目名称:SchoStack,代码行数:29,代码来源:DataAnnotationValidationHtmlConventions.cs


示例11: DownloadEventArgs

 public DownloadEventArgs(string fileLocation, Guid taskGuid, RequestData request, string errorDescription = null)
 {
     FileLocation = fileLocation;
     TaskGuid = taskGuid;
     ErrorDescription = errorDescription;
     Request = request;
 }
开发者ID:StorozhenkoDmitry,项目名称:SimpleHttp,代码行数:7,代码来源:DownloadEventArgs.cs


示例12: BuildOAuthHeader

		private string BuildOAuthHeader(RequestData requestData, string fullUrl, IDictionary<string, string> parameters, RequestPayload requestBody)
		{
			var httpMethod = requestData.HttpMethod.ToString().ToUpperInvariant();

			var oauthRequest = new OAuthRequest
				{
					Type = OAuthRequestType.ProtectedResource,
					RequestUrl = fullUrl,
					Method = httpMethod,
					ConsumerKey = _oAuthCredentials.ConsumerKey,
					ConsumerSecret = _oAuthCredentials.ConsumerSecret,
				};

			if (!string.IsNullOrEmpty(requestData.OAuthToken))
			{
				oauthRequest.Token = requestData.OAuthToken;
				oauthRequest.TokenSecret = requestData.OAuthTokenSecret;
			}

			if (ShouldReadParamsFromBody(parameters, requestBody))
			{
				var bodyParams = HttpUtility.ParseQueryString(requestBody.Data);
				var keys = bodyParams.AllKeys.Where(x => !string.IsNullOrEmpty(x));
				foreach (var key in keys)
				{
					parameters.Add(key, bodyParams[key]);
				}
			}

			return oauthRequest.GetAuthorizationHeader(parameters);
		}
开发者ID:AnthonySteele,项目名称:SevenDigital.Api.Wrapper,代码行数:31,代码来源:RequestBuilder.cs


示例13: HandleGetRequest

        public override void HandleGetRequest(HttpProcessor p)
        {
            Log.Debug(@"request: {0}", p.HttpUrl);

            LastRequestData = new RequestData(p.HttpMethod, p.HttpUrl, p.HttpProtocolVersionstring, p.HttpHeaders);

            SendResponse(p);
        }
开发者ID:alexey-kadyrov,项目名称:DocaLabs-Utils,代码行数:8,代码来源:TestHttpServer.cs


示例14: SetUp

        public void SetUp()
        {
            dictionary = new Dictionary<string, object>();
            aggregate = new AggregateDictionary();
            aggregate.AddLocator(RequestDataSource.Route, key => dictionary.ContainsKey(key) ? dictionary[key] : null);

            request = new RequestData(aggregate);
        }
开发者ID:joshuaflanagan,项目名称:fubumvc,代码行数:8,代码来源:RequestDataTester.cs


示例15: SetUp

        public void SetUp()
        {
            dictionary = new Dictionary<string, object>();
            aggregate = new AggregateDictionary();
            aggregate.AddDictionary(dictionary);

            request = new RequestData(aggregate);
        }
开发者ID:henninga,项目名称:fubumvc,代码行数:8,代码来源:RequestDataTester.cs


示例16: GetAuthorizationHeader

		private string GetAuthorizationHeader(RequestData requestData, string fullUrl, ApiRequest apiRequest)
		{
			if (requestData.RequiresSignature)
			{
				return BuildOAuthHeader(requestData, fullUrl, apiRequest.Parameters);
			}

			return "oauth_consumer_key=" + _oAuthCredentials.ConsumerKey;
		}
开发者ID:DrValani,项目名称:SevenDigital.Api.Wrapper,代码行数:9,代码来源:RequestBuilder.cs


示例17: BaseUri

		public string BaseUri(RequestData requestData)
		{
			if (requestData.UseHttps)
			{
				return _apiUri.SecureUri;
			}

			return _apiUri.Uri;
		}
开发者ID:DrValani,项目名称:SevenDigital.Api.Wrapper,代码行数:9,代码来源:BaseUriFromApiUri.cs


示例18: FindAttributeValidators

        public IEnumerable<ValidationAttribute> FindAttributeValidators(RequestData requestData)
        {
            if (requestData.InputType == null)
                return new List<ValidationAttribute>();

            var properties = InputPropertyMatcher.FindPropertyData(requestData);

            return properties.SelectMany(propertyInfo => propertyInfo.GetAllAttributes<ValidationAttribute>());
        }
开发者ID:eByte23,项目名称:SchoStack,代码行数:9,代码来源:AttribValidatorFinder.cs


示例19: RequestTelemetry

        /// <summary>
        /// Initializes a new instance of the <see cref="RequestTelemetry"/> class.
        /// </summary>
        public RequestTelemetry()
        {
            this.Data = new RequestData();
            this.context = new TelemetryContext(this.Data.properties, new Dictionary<string, string>());

            // Initialize required fields
            this.Id = WeakConcurrentRandom.Instance.Next().ToString(CultureInfo.InvariantCulture);
            this.ResponseCode = "200";
            this.Success = true;
        }
开发者ID:bitstadium,项目名称:HockeySDK-Windows,代码行数:13,代码来源:RequestTelemetry.cs


示例20: BeginRequest

        public void BeginRequest(RequestData data, HttpAsyncCallback callback, object state)
        {
            var request = WebRequest.CreateHttp(data.Request.Url);
            request.Method = data.Request.Method;
            //data.Request.BodySize;
            //data.Request.Comment;

            //data.Request.Cookies;
            //data.Request.Headers;
            //data.Request.HeadersSize;
            //data.Request.HttpVersion;
            //data.Request.PostData;
            //data.Request.QueryString;

            var gate = new AutoResetEvent(false);
            if (!string.IsNullOrEmpty(data.Request.PostData.Text))
            {

                request.BeginGetRequestStream(ar =>
                {
                    var postStream = request.EndGetRequestStream(ar);
                    byte[] byteArray = Encoding.UTF8.GetBytes(data.Request.PostData.Text);
                    postStream.Write(byteArray, 0, byteArray.Length);
                    postStream.Flush();

                    gate.Set();

                }, state);
            }
            else
            {
                gate.Set();
            }

            gate.WaitOne();

            var result = request.BeginGetResponse(ar =>
                {
                    var r = request.EndGetResponse(ar);
                    var s = r.GetResponseStream();
                    var d = ReadFully(s);
                    var txt = Encoding.UTF8.GetString(d, 0, d.Length);
                    data.Response = new Response()
                        {
                            Content = new Content()
                                {
                                    Text = txt
                                }
                        };
                    gate.Set();
                }, state);

            gate.WaitOne();

        }
开发者ID:Domer79,项目名称:CIAPI.CS,代码行数:55,代码来源:RequestController.cs



注:本文中的RequestData类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# RequestDelegate类代码示例发布时间:2022-05-24
下一篇:
C# RequestContext类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap