Exemplo n.º 1
0
        public AppContentResponder(ContentResponder commonResponder, AppConf conf, DataSettings dataSettings = null, ILogger logger = null)
            : base(commonResponder.BamConf, logger)
        {
            if (conf.BamConf == null)
            {
                conf.BamConf = commonResponder.BamConf;
            }
            DataSettings       = dataSettings ?? DataSettings.Current;
            ContentResponder   = commonResponder;
            ServerRoot         = commonResponder.ServerRoot;
            AppConf            = conf;
            AppRoot            = AppConf.AppRoot;
            AppTemplateManager = new AppDustRenderer(this);
            AppContentLocator  = ContentLocator.Load(this);
            Fs commonRoot = new Fs(new DirectoryInfo(Path.Combine(ServerRoot.Root, CommonFolder)));

            ContentHandlers   = new Dictionary <string, ContentHandler>();
            AllRequestHandler = new ContentHandler($"{conf.Name}.AllRequestHandler", AppRoot)
            {
                CheckPaths = false
            };
            CustomHandlerMethods = new List <MethodInfo>();
            CommonContentLocator = ContentLocator.Load(commonRoot);
            SetUploadHandler();
            SetBaseIgnorePrefixes();
            ContentHandlerScanTask = ScanForContentHandlers();
            SetAllRequestHandler();
        }
Exemplo n.º 2
0
 public void SetCustomContentHandler(ContentHandler customContentHandler)
 {
     foreach (string path in customContentHandler.Paths)
     {
         ContentHandlers[path.ToLowerInvariant()] = customContentHandler;
     }
 }
Exemplo n.º 3
0
        public void SetCustomContentHandler(string name, string[] paths, Func <IHttpContext, Fs, byte[]> handler)
        {
            ContentHandler customHandler = new ContentHandler(name, AppRoot, paths)
            {
                GetContent = handler
            };

            SetCustomContentHandler(customHandler);
        }