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


C# NancyContext.ToFullPath方法代码示例

本文整理汇总了C#中Nancy.NancyContext.ToFullPath方法的典型用法代码示例。如果您正苦于以下问题:C# NancyContext.ToFullPath方法的具体用法?C# NancyContext.ToFullPath怎么用?C# NancyContext.ToFullPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Nancy.NancyContext的用法示例。


在下文中一共展示了NancyContext.ToFullPath方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BuildAbsoluteUri

 public Uri BuildAbsoluteUri(NancyContext context, string routeName, dynamic parameters = null)
 {
   var parameterDictionary = ToDictionary(parameters as object ?? new { });
   var pathTemplate = GetRouteTemplateFromRouteName(routeName);
   if (pathTemplate == null)
     throw new UnknownRouteException(routeName, this.AllRoutes);
   var realizedPath = 
     this.segmentExtractor.Extract(pathTemplate.Path)
         .Aggregate("~", (accumulatedtPath, segment) => GetSegmentValue(segment, parameterDictionary, accumulatedtPath));
   return uriFilter.Apply(new Uri(GetBaseUri(context), context.ToFullPath(realizedPath)), context);
 }
开发者ID:horsdal,项目名称:Nancy.Linker,代码行数:11,代码来源:ResourceLinker.cs

示例2: After

        private void After(NancyContext nancyContext)
        {
            if (nancyContext.Response != null)
            {
                var status = (int) nancyContext.Response.StatusCode;
                var level = LogLevel.Error;

                if (status >= 400 && status <= 600)
                {
                    var req = nancyContext.Request;

                    if (status < 500)
                        level = LogLevel.Warn;

                    var logMessage = String.Format("Responding {0} for {1} to path {2}", status, req.Method,
                        nancyContext.ToFullPath(req.Path));
                    Logary.Logging.GetCurrentLogger()
                        .Log(level, logMessage, GetLogData(nancyContext), null, null, nancyContext.ToFullPath(req.Path));
                }

                nancyContext.Response.Headers.Add("Access-Control-Allow-Origin", "*");
                nancyContext.Response.Headers.Add("Access-Control-Allow-Methods",
                    "GET, POST, PUT, DELETE, OPTIONS, PATCH");
                nancyContext.Response.Headers.Add("Access-Control-Allow-Headers", "Content-Type");
            }
        }
开发者ID:cognisant,项目名称:cr-cqrs-scaffold,代码行数:26,代码来源:RestApiBootstrapper.cs

示例3: Error

        private Response Error(NancyContext nancyContext, Exception ex)
        {
            var req = nancyContext.Request;
            var logMessage = string.Format("An error occurred handling {0} to {1}", nancyContext.Request.Method,
                nancyContext.ToFullPath(req.Path));

            Logary.Logging.GetCurrentLogger()
                .Log(LogLevel.Error, logMessage, GetLogData(nancyContext), null, ex, nancyContext.ToFullPath(req.Path));
            return nancyContext.Response;
        }
开发者ID:cognisant,项目名称:cr-cqrs-scaffold,代码行数:10,代码来源:RestApiBootstrapper.cs

示例4: RegisterFacebookOAuthClientPerRequest

            private void RegisterFacebookOAuthClientPerRequest(TinyIoC.TinyIoCContainer container, NancyContext context)
            {
            var facebookOAuthClient =
                new Facebook.FacebookOAuthClient(container.Resolve<Facebook.IFacebookApplication>())
                    {
                        RedirectUri = new Uri("http://localhost:45254" + context.ToFullPath("~/facebook/login/callback"))
                    };

            container.Register(facebookOAuthClient);
            }
开发者ID:prabirshrestha,项目名称:NancyFacebookSample,代码行数:10,代码来源:Bootstrapper.cs


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