コード例 #1
0
ファイル: ServerModule.cs プロジェクト: weeble/ohos
        public ServerModule(string aHttpDirectory)
        {
            UserList = new UserList();
            UserList.SetUser(new User("chrisc", "Chris Cheung", GravatarUrl("*****@*****.**")));
            UserList.SetUser(new User("andreww", "Andrew Wilson", GravatarUrl("*****@*****.**")));
            UserList.SetUser(new User("simonc", "Simon Chisholm", GravatarUrl("*****@*****.**")));
            UserList.SetUser(new User("grahamd", "Graham Darnell", GravatarUrl("*****@*****.**")));
            UserList.SetUser(new User("stathisv", "Stathis Voukelatos", GravatarUrl("*****@*****.**")));

            var serverHealthApp = new ServerHealthApp(Path.Combine(aHttpDirectory, "serverhealth"));
            AppsStateFactory appsStateFactory = new AppsStateFactory(
                serverHealthApp,
                () => DateTime.UtcNow,
                new ServerTabTimeoutPolicy(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(10)),
                UserList);

            LoginApp loginApp = new LoginApp(UserList, Path.Combine(aHttpDirectory, "login"));
            var appsState = appsStateFactory.CreateAppsState();
            iCleanupStack.Add(XappServer = new Server(appsState, new Strand(), aHttpDirectory));
            XappServer.SetXappAdapter(aXapp => new UserAndBrowserFilter(aXapp, loginApp, UserList));
            XappServer.AddXapp("login", loginApp);
            XappServer.AddXapp("serverhealth", serverHealthApp);

            //var browserDiscriminationFilter = new BrowserDiscriminationFilter();
            //var loginFilter = new LoginFilter(loginApp);

            //XappServer.AddFilter(browserDiscriminationFilter);
            //XappServer.AddFilter(loginFilter);

            iCleanupStack.Add(new Gate.Hosts.Firefly.ServerFactory().Create(XappServer.HandleRequest, 12921));
        }