Example #1
0
        protected override void ConfigureConventions(NancyConventions nancyConventions)
        {
            base.ConfigureConventions(nancyConventions);

            nancyConventions.StaticContentsConventions.Clear();

            foreach (var source in StaticContentsConventions.Reverse())
            {
                nancyConventions.StaticContentsConventions.AddDirectory(source.Key, source.Value);
            }
        }
Example #2
0
        private StaticContentProvider BuildStaticContentProvider()
        {
            var rootPathProvider = new RootPathProvider();
            var staticContnetConventions = new StaticContentsConventions(new List<Func<Context, string, Response>>
            {
                StaticContentConventionBuilder.AddDirectory("Content")
            });
            var staticContentProvider = new StaticContentProvider(rootPathProvider, staticContnetConventions);

            FileResponse.SafePaths.Add(rootPathProvider.GetRootPath());

            return staticContentProvider;
        }
Example #3
0
        private StaticContentProvider BuildStaticContentProvider()
        {
            var rootPathProvider         = new RootPathProvider();
            var staticContnetConventions = new StaticContentsConventions(new List <Func <Context, string, Response> >
            {
                StaticContentConventionBuilder.AddDirectory("Content")
            });
            var staticContentProvider = new StaticContentProvider(rootPathProvider, staticContnetConventions);

            FileResponse.SafePaths.Add(rootPathProvider.GetRootPath());

            return(staticContentProvider);
        }
Example #4
0
 public StaticContentStartup(IRootPathProvider rootPathProvider, StaticContentsConventions conventions)
 {
     this.rootPathProvider = rootPathProvider;
     this.conventions      = conventions;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DefaultStaticContentProvider"/> class, using the
 /// provided <paramref name="rootPathProvider"/> and <paramref name="conventions"/>.
 /// </summary>
 /// <param name="rootPathProvider">The current root path provider.</param>
 /// <param name="conventions">The static content conventions.</param>
 public DefaultStaticContentProvider(IRootPathProvider rootPathProvider, StaticContentsConventions conventions)
 {
     this.rootPathProvider = rootPathProvider;
     this.rootPath = this.rootPathProvider.GetRootPath();
     this.conventions = conventions;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="StaticContent"/> class, using the
 /// provided <paramref name="rootPathProvider"/> and <paramref name="conventions"/>.
 /// </summary>
 /// <param name="rootPathProvider">The current root path provider.</param>
 /// <param name="conventions">The static content conventions.</param>
 public StaticContent(IRootPathProvider rootPathProvider, StaticContentsConventions conventions)
 {
     StaticContent.rootPathProvider = rootPathProvider;
     StaticContent.conventions      = conventions;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DefaultStaticContentProvider"/> class, using the
 /// provided <paramref name="rootPathProvider"/> and <paramref name="conventions"/>.
 /// </summary>
 /// <param name="rootPathProvider">The current root path provider.</param>
 /// <param name="conventions">The static content conventions.</param>
 public DefaultStaticContentProvider(IRootPathProvider rootPathProvider, StaticContentsConventions conventions)
 {
     this.rootPathProvider = rootPathProvider;
     this.rootPath         = this.rootPathProvider.GetRootPath();
     this.conventions      = conventions;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="StaticContentApplicationStartup"/> class, using the
 /// provided <paramref name="rootPathProvider"/> and <paramref name="conventions"/>.
 /// </summary>
 /// <param name="rootPathProvider">The current root path provider.</param>
 /// <param name="conventions">The static content conventions.</param>
 public StaticContentApplicationStartup(IRootPathProvider rootPathProvider, StaticContentsConventions conventions)
 {
     this.rootPathProvider = rootPathProvider;
     this.conventions = conventions;
 }
Example #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StaticContent"/> class, using the
 /// provided <paramref name="rootPathProvider"/> and <paramref name="conventions"/>.
 /// </summary>
 /// <param name="rootPathProvider">The current root path provider.</param>
 /// <param name="conventions">The static content conventions.</param>
 public StaticContent(IRootPathProvider rootPathProvider, StaticContentsConventions conventions)
 {
     StaticContent.rootPathProvider = rootPathProvider;
     StaticContent.conventions = conventions;
 }