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

C# System.UriTemplateMatch类代码示例

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

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



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

示例1: Test1Handler

 private void Test1Handler(HttpEntityManager http, UriTemplateMatch match)
 {
     if (http.User != null) 
         http.Reply("OK", 200, "OK", "text/plain");
     else 
         http.Reply("Please authenticate yourself", 401, "Unauthorized", "text/plain");
 }
开发者ID:kijanawoodard,项目名称:EventStore,代码行数:7,代码来源:TestController.cs


示例2: TestEncodingHandler

        private void TestEncodingHandler(HttpEntityManager http, UriTemplateMatch match)
        {
            var a = match.BoundVariables["a"];
            var b = match.BoundVariables["b"];

            http.Reply(new { a = a, b = b, rawSegment = http.RequestedUrl.Segments[2] }.ToJson(), 200, "OK", "application/json");
        }
开发者ID:kijanawoodard,项目名称:EventStore,代码行数:7,代码来源:TestController.cs


示例3: TestAnonymousHandler

 private void TestAnonymousHandler(HttpEntityManager http, UriTemplateMatch match)
 {
     if (http.User != null)
         http.Reply("ERROR", 500, "ERROR", "text/plain");
     else 
         http.Reply("OK", 200, "OK", "text/plain");
 }
开发者ID:kijanawoodard,项目名称:EventStore,代码行数:7,代码来源:TestController.cs


示例4: Find

 public RouteHandler Find(HttpListenerRequest request, out UriTemplateMatch templateMatch)
 {
     var reqId = request.HttpMethod + ":" + request.Url.LocalPath;
     KeyValuePair<RouteHandler, Uri> rh;
     if (Cache.TryGetValue(reqId, out rh))
     {
         templateMatch = rh.Key.Template.Match(rh.Value, request.Url);
         return rh.Key;
     }
     templateMatch = null;
     List<RouteHandler> handlers;
     if (!MethodRoutes.TryGetValue(request.HttpMethod, out handlers))
         return null;
     var reqUrl = request.Url;
     var url = reqUrl.ToString();
     var baseAddr = new Uri(url.Substring(0, url.Length - request.RawUrl.Length));
     foreach (var h in handlers)
     {
         var match = h.Template.Match(baseAddr, reqUrl);
         if (match != null)
         {
             templateMatch = match;
             Cache.TryAdd(reqId, new KeyValuePair<RouteHandler, Uri>(h, baseAddr));
             return h;
         }
     }
     return null;
 }
开发者ID:nutrija,项目名称:revenj,代码行数:28,代码来源:Routes.cs


示例5: OnPostShutdown

 private void OnPostShutdown(HttpEntity entity, UriTemplateMatch match)
 {
     Publish(new ClientMessage.RequestShutdown());
     entity.Manager.Reply(HttpStatusCode.OK,
                          "OK",
                          e => Log.ErrorException(e, "Error while closing http connection (admin controller)"));
 }
开发者ID:robashton,项目名称:EventStore,代码行数:7,代码来源:AdminController.cs


示例6: OnGetFreshStats

        private void OnGetFreshStats(HttpEntityManager entity, UriTemplateMatch match)
        {
            var envelope = new SendToHttpEnvelope(_networkSendQueue,
                                                  entity,
                                                  Format.GetFreshStatsCompleted,
                                                  Configure.GetFreshStatsCompleted);

            var statPath = match.BoundVariables["statPath"];
            var statSelector = GetStatSelector(statPath);

            bool useMetadata;
            if (!bool.TryParse(match.QueryParameters["metadata"], out useMetadata))
                useMetadata = false;

            bool useGrouping;
            if (!bool.TryParse(match.QueryParameters["group"], out useGrouping))
                useGrouping = true;

            if (!useGrouping && !string.IsNullOrEmpty(statPath))
            {
                SendBadRequest(entity, "Dynamic stats selection works only with grouping enabled");
                return;
            }
             
            Publish(new MonitoringMessage.GetFreshStats(envelope, statSelector, useMetadata, useGrouping));
        }
开发者ID:Kristinn-Stefansson,项目名称:EventStore,代码行数:26,代码来源:StatController.cs


示例7: AckMessages

        private void AckMessages(HttpEntityManager http, UriTemplateMatch match)
        {
            var envelope = new NoopEnvelope();
            var groupname = match.BoundVariables["subscription"];
            var stream = match.BoundVariables["stream"];
            var messageIds = match.BoundVariables["messageIds"];
            var ids = new List<Guid>();
            foreach (var messageId in messageIds.Split(new[] { ',' }))
            {
                Guid id;
                if (!Guid.TryParse(messageId, out id))
                {
                    http.ReplyStatus(HttpStatusCode.BadRequest, "messageid should be a properly formed guid", exception => { });
                    return;
                }
                ids.Add(id);
            }

            var cmd = new ClientMessage.PersistentSubscriptionAckEvents(
                                             Guid.NewGuid(),
                                             Guid.NewGuid(),
                                             envelope,
                                             BuildSubscriptionGroupKey(stream, groupname),
                                             ids.ToArray(),
                                             http.User);
            Publish(cmd);
            http.ReplyStatus(HttpStatusCode.Accepted, "", exception => { });
        }
开发者ID:EventStore,项目名称:EventStore,代码行数:28,代码来源:PersistentSubscriptionController.cs


示例8: TryUriTemplateMatch

 private bool TryUriTemplateMatch(string uri, out UriTemplateMatch uriTemplateMatch)
 {
     var uriTemplate = new UriTemplate(uri);
     var serverPath = Request.Url.GetServerBaseUri();
     uriTemplateMatch = uriTemplate.Match(new Uri(serverPath), Request.Url);
     return uriTemplateMatch != null;
 }
开发者ID:JamesTryand,项目名称:minimods,代码行数:7,代码来源:HttpContext.cs


示例9: OnPostShutdown

 private void OnPostShutdown(HttpEntity entity, UriTemplateMatch match)
 {
     Log.Info("Request shut down of node because shutdown command has been received.");
     Publish(new ClientMessage.RequestShutdown(exitProcessOnShutdown: true));
     entity.Manager.ReplyStatus(HttpStatusCode.OK,
                          "OK",
                          e => Log.ErrorException(e, "Error while closing http connection (admin controller)"));
 }
开发者ID:base31,项目名称:geteventstore_EventStore,代码行数:8,代码来源:AdminController.cs


示例10: OnGetTcpConnectionStats

 private void OnGetTcpConnectionStats(HttpEntityManager entity, UriTemplateMatch match)
 {
     var envelope = new SendToHttpEnvelope(_networkSendQueue,
                                           entity,
                                           Format.GetFreshTcpConnectionStatsCompleted,
                                           Configure.GetFreshTcpConnectionStatsCompleted);
     Publish(new MonitoringMessage.GetFreshTcpConnectionStats(envelope));
 }
开发者ID:SzymonPobiega,项目名称:EventStore,代码行数:8,代码来源:StatController.cs


示例11: UriToActionMatch

 public UriToActionMatch(UriTemplateMatch templateMatch, 
                         ControllerAction controllerAction, 
                         Func<HttpEntityManager, UriTemplateMatch, RequestParams> requestHandler)
 {
     TemplateMatch = templateMatch;
     ControllerAction = controllerAction;
     RequestHandler = requestHandler;
 }
开发者ID:Kristinn-Stefansson,项目名称:EventStore,代码行数:8,代码来源:UriToActionMatch.cs


示例12: UriToActionMatch

 public UriToActionMatch(UriTemplateMatch templateMatch, 
                         ControllerAction controllerAction, 
                         Action<HttpEntity, UriTemplateMatch> requestHandler)
 {
     TemplateMatch = templateMatch;
     ControllerAction = controllerAction;
     RequestHandler = requestHandler;
 }
开发者ID:base31,项目名称:geteventstore_EventStore,代码行数:8,代码来源:UriToActionMatch.cs


示例13: OnGetOptions

 private void OnGetOptions(HttpEntityManager entity, UriTemplateMatch match)
 {
     entity.ReplyTextContent(Codec.Json.To(GetOptionsInfo(options)),
                             HttpStatusCode.OK,
                             "OK",
                             entity.ResponseCodec.ContentType,
                             null,
                             e => Log.ErrorException(e, "error while writing http response (options)"));
 }
开发者ID:BrunoMVPCosta,项目名称:EventStore,代码行数:9,代码来源:InfoController.cs


示例14: SerializedResultArrayBeta

 public SerializedResultArrayBeta(List<Result> x, UriTemplateMatch templateMatch, Uri Prefix, UriTemplate ResultResourceTemplate, UriTemplate ResourceArrayTemplate)
 {
     List<SerializedResultArrayEntry> r = new List<SerializedResultArrayEntry>();
     foreach (Result result in x)
     {
         r.Add(new SerializedResultArrayEntry(result, Prefix, ResultResourceTemplate));
     }
     Results = r;
 }
开发者ID:TheHandsomeCoder,项目名称:SOFT512RestAPI,代码行数:9,代码来源:SerializedResultArray.cs


示例15: GetPrincipal

        /// <summary>
        /// Virtual method to be able to extend principal.
        /// Returns "Guest" identity with no roles.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="match"></param>
        /// <returns></returns>
        public virtual IPrincipal GetPrincipal(HttpContext context, UriTemplateMatch match)
        {
            // using System.Security.Permissions;
            // using System.Security.Principal;

            GenericIdentity gi = new GenericIdentity("Guest");
            GenericPrincipal genPrincipal = new GenericPrincipal(gi, new string[]{});

            return genPrincipal;
        }
开发者ID:swizkon,项目名称:gigagoga,代码行数:17,代码来源:RESTRouter.cs


示例16: OnGetPing

 private void OnGetPing(HttpEntityManager entity, UriTemplateMatch match)
 {
     var response = new HttpMessage.TextMessage("Ping request successfully handled");
     entity.ReplyTextContent(Format.TextMessage(entity, response),
                             HttpStatusCode.OK,
                             "OK",
                             entity.ResponseCodec.ContentType,
                             null,
                             e => Log.ErrorException(e, "Error while writing HTTP response (ping)"));
 }
开发者ID:danieldeb,项目名称:EventStore,代码行数:10,代码来源:PingController.cs


示例17: OnListNodeSubsystems

 private void OnListNodeSubsystems(HttpEntityManager http, UriTemplateMatch match)
 {
     http.ReplyTextContent(
     Codec.Json.To(_enabledNodeSubsystems),
     200,
     "OK",
     "application/json",
     null,
     ex => Log.InfoException(ex, "Failed to prepare main menu")
     );
 }
开发者ID:jjvdangelo,项目名称:EventStore,代码行数:11,代码来源:WebSiteController.cs


示例18: OnGetInfo

 private void OnGetInfo(HttpEntityManager entity, UriTemplateMatch match)
 {
     entity.ReplyTextContent(Codec.Json.To(new
                             {
                                 ESVersion = VersionInfo.Version
                             }),
                             HttpStatusCode.OK,
                             "OK",
                             entity.ResponseCodec.ContentType,
                             null,
                             e => Log.ErrorException(e, "Error while writing http response (info)"));
 }
开发者ID:adbrowne,项目名称:EventStore,代码行数:12,代码来源:InfoController.cs


示例19: GetNackAction

 private static ClientMessages.NakAction GetNackAction(HttpEntityManager manager, UriTemplateMatch match, NakAction nakAction = NakAction.Unknown)
 {
     var rawValue = match.BoundVariables["action"] ?? string.Empty;
     switch (rawValue.ToLowerInvariant())
     {
         case "park": return ClientMessages.NakAction.Park;
         case "retry": return ClientMessages.NakAction.Retry;
         case "skip": return ClientMessages.NakAction.Skip;
         case "stop": return ClientMessages.NakAction.Stop;
         default: return ClientMessages.NakAction.Unknown;
     }
 }
开发者ID:EventStore,项目名称:EventStore,代码行数:12,代码来源:PersistentSubscriptionController.cs


示例20: OnGetFreshStats

        private void OnGetFreshStats(HttpEntity entity, UriTemplateMatch match)
        {
            var envelope = new SendToHttpEnvelope(
                    entity,
                    Format.GetFreshStatsCompleted,
                    Configure.GetFreshStatsCompleted);

            var statPath = match.BoundVariables["statPath"];
            var statSelector = GetStatSelector(statPath);

            Publish(new MonitoringMessage.GetFreshStats(envelope, statSelector));
        }
开发者ID:jpierson,项目名称:EventStore,代码行数:12,代码来源:StatController.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# System.Url类代码示例发布时间:2022-05-26
下一篇:
C# System.UriTemplate类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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