当前位置: 首页>>代码示例>>C#>>正文


C# System.UriTemplateMatch类代码示例

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


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


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