Exemple #1
0
 public ContentFolder(string path, string prefix, Func <IHttpContext, Task> handler)
 {
     Logger              = DefaultLogger.GetInstance <IContentFolder>();
     FolderPath          = path;
     Prefix              = prefix;
     FileNotFoundHandler = handler ?? DefaultFileNotFoundHandler;
 }
Exemple #2
0
        public RestServer(IRouter router, IRouteScanner scanner, ILogger <IRestServer> logger)
        {
            if (!HttpListener.IsSupported)
            {
                throw new PlatformNotSupportedException("Windows Server 2003 (or higher) or Windows XP SP2 (or higher) is required to use instances of this class.");
            }

            Router       = router ?? new Router(DefaultLogger.GetInstance <IRouter>());
            RouteScanner = scanner ?? new RouteScanner(DefaultLogger.GetInstance <IRouteScanner>());
            Logger       = logger ?? DefaultLogger.GetInstance <IRestServer>();

            RouteScanner.Services = Router.Services;

            Listener       = new HttpListener();
            RequestHandler = new Thread(RequestListenerAsync);
        }
Exemple #3
0
 public RouteScanner(ILogger <IRouteScanner> logger)
 {
     Logger = logger ?? DefaultLogger.GetInstance <IRouteScanner>();
 }