コード例 #1
0
        public WifiServerConnector(IConfigSource config, IHttpServer server, string configName) :
            base(config, server, configName)
        {
            IConfig serverConfig = config.Configs[m_ConfigName];
            if (serverConfig == null)
                throw new Exception(String.Format("No section {0} in config file", m_ConfigName));

            //
            // Leaving this here for educational purposes
            //
            //if (Environment.StaticVariables.ContainsKey("AppDll"))
            //{
            //    object[] args = new object[] { config, server };
            //    WebApp app = ServerUtils.LoadPlugin<IWebApp>(Environment.StaticVariables["AppDll"].ToString(), args);
            //    Environment.InitializeWebApp(app);
            //}

            // Launch the WebApp
            WebApp app = new WebApp(config, m_ConfigName, server);

            // Register all the handlers
            server.AddStreamHandler(new WifiGetHandler(app));
            server.AddStreamHandler(new WifiInstallGetHandler(app));
            server.AddStreamHandler(new WifiInstallPostHandler(app));
            server.AddStreamHandler(new WifiLoginHandler(app));
            server.AddStreamHandler(new WifiLogoutHandler(app));
            server.AddStreamHandler(new WifiUserAccountGetHandler(app));
            server.AddStreamHandler(new WifiUserAccountPostHandler(app));
            server.AddStreamHandler(new WifiUserManagementGetHandler(app));
            server.AddStreamHandler(new WifiUserManagementPostHandler(app));
            server.AddStreamHandler(new WifiRegionManagementPostHandler(app));
            server.AddStreamHandler(new WifiRegionManagementGetHandler(app));
        }
コード例 #2
0
 public WifiUserManagementGetHandler(WebApp webapp) :
     base("GET", "/wifi/admin/users")
 {
     m_WebApp = webapp;
 }
コード例 #3
0
        public WifiScriptFace(WebApp webApp)
        {
            m_log.Debug("[WifiScriptFace]: Starting...");

            m_WebApp = webApp;
        }
コード例 #4
0
 public WifiHeadHandler(WebApp webapp) :
     base("HEAD", "/wifi")
 {
     m_WebApp = webapp;
 }
コード例 #5
0
 public WifiLogoutHandler(WebApp webapp) :
     base("GET", "/wifi/logout")
 {
     m_WebApp = webapp;
 }
コード例 #6
0
 public WifiTOSGetHandler(WebApp webapp)
     : base("GET", "/wifi/tos")
 {
     m_WebApp = webapp;
 }
コード例 #7
0
 public WifiHeadHandler(WebApp webapp)
     : base("HEAD", "/wifi")
 {
     m_WebApp = webapp;
 }
コード例 #8
0
 public WifiInstallPostHandler(WebApp webapp) :
     base("POST", "/wifi/install")
 {
     m_WebApp = webapp;
 }
コード例 #9
0
 public WifiHyperlinkGetHandler(WebApp webapp) :
     base("GET", "/wifi/linkregion")
 {
     m_WebApp = webapp;
 }
コード例 #10
0
 public WifiHyperlinkPostHandler(WebApp webapp) :
     base("POST", "/wifi/linkregion")
 {
     m_WebApp = webapp;
 }
コード例 #11
0
        private void Initialize(IHttpServer server)
        {
            m_log.DebugFormat("[Wifi]: Initializing. Server at port {0}.", server.Port);

            IConfig serverConfig = m_Config.Configs[ConfigName];
            if (serverConfig == null)
                throw new Exception(String.Format("No section {0} in config file", ConfigName));

            // Launch the WebApp
            m_WebApp = new WebApp(m_Config, ConfigName, m_Server, m_SceneActor);

            // Register all the handlers
            BaseStreamHandler defaultHandler = new WifiDefaultHandler(m_WebApp);
            AddStreamHandler(defaultHandler);
            AddStreamHandler(new WifiRootHandler(defaultHandler));
            AddStreamHandler(new WifiHeadHandler(m_WebApp));
            AddStreamHandler(new WifiNotifyHandler(m_WebApp));
            AddStreamHandler(new WifiInstallGetHandler(m_WebApp));
            AddStreamHandler(new WifiInstallPostHandler(m_WebApp));
            AddStreamHandler(new WifiLoginHandler(m_WebApp));
            AddStreamHandler(new WifiLogoutHandler(m_WebApp));
            AddStreamHandler(new WifiForgotPasswordGetHandler(m_WebApp));
            AddStreamHandler(new WifiForgotPasswordPostHandler(m_WebApp));
            AddStreamHandler(new WifiPasswordRecoverGetHandler(m_WebApp));
            AddStreamHandler(new WifiPasswordRecoverPostHandler(m_WebApp));
            AddStreamHandler(new WifiUserAccountGetHandler(m_WebApp));
            AddStreamHandler(new WifiUserAccountPostHandler(m_WebApp));
            AddStreamHandler(new WifiUserManagementGetHandler(m_WebApp));
            AddStreamHandler(new WifiUserManagementPostHandler(m_WebApp));
            AddStreamHandler(new WifiConsoleHandler(m_WebApp));

            AddStreamHandler(new WifiInventoryLoadGetHandler(m_WebApp));
            AddStreamHandler(new WifiInventoryGetHandler(m_WebApp));
            AddStreamHandler(new WifiInventoryPostHandler(m_WebApp));

            AddStreamHandler(new WifiHyperlinkGetHandler(m_WebApp));
            AddStreamHandler(new WifiHyperlinkPostHandler(m_WebApp));

            AddStreamHandler(new WifiTOSGetHandler(m_WebApp));
            AddStreamHandler(new WifiTOSPostHandler(m_WebApp));

            AddStreamHandler(new WifiGroupsManagementGetHandler(m_WebApp));
            AddStreamHandler(new WifiGroupsManagementPostHandler(m_WebApp));

            //server.AddStreamHandler(new WifiRegionManagementPostHandler(app));
            //server.AddStreamHandler(new WifiRegionManagementGetHandler(app));

            // Add handlers for serving configured paths
            IEnumerable<string> servePaths = serverConfig.GetKeys().Where(option => option.StartsWith(m_ServePathPrefix));
            if (servePaths.Count() > 0)
            {
                foreach (string servePath in servePaths)
                {
                    string paths = serverConfig.GetString(servePath, string.Empty);
                    string[] parts = paths.Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries);
                    if (parts.Count() == 2)
                        AddStreamHandler(new WifiGetHandler(parts[0], parts[1]));
                    else
                        m_log.WarnFormat("[Wifi]: Invalid format with configuration option {0}: {1}", servePath, paths);
                }
            }

            // Load addons
            IEnumerable<string> addonVars = serverConfig.GetKeys().Where(option => option.StartsWith(m_AddonPrefix));
            if (addonVars.Count() > 0)
            {
                foreach (string addonVar in addonVars)
                {
                    string addonDll = serverConfig.GetString(addonVar, string.Empty);
                    if (addonDll != string.Empty)
                    {
                        m_log.InfoFormat("[Wifi]: Loading addon {0}", addonDll);
                        object[] args = new object[] { m_Config, ConfigName, m_Server, m_WebApp };
                        IWifiAddon addon = ServerUtils.LoadPlugin<IWifiAddon>(addonDll, args);

                        if (addon == null)
                            m_log.WarnFormat("[Wifi]: Unable to load addon {0}", addonDll);
                    }
                }
            }

            // Load Wifi addons as mono addins, if they exist
            try
            {
                AddinManager.AddExtensionNodeHandler("/Diva/Wifi/Addon", OnExtensionChanged);
            }
            catch (InvalidOperationException e)
            {
                m_log.DebugFormat("[Wifi]: extension point /Diva/Wifi/Addon not found");
            }
        }
コード例 #12
0
 public WifiInventoryGetHandler(WebApp webapp) :
     base("GET", "/wifi/user/inventory")
 {
     m_WebApp = webapp;
 }
コード例 #13
0
 public WifiInventoryPostHandler(WebApp webapp) :
     base("POST", "/wifi/user/inventory")
 {
     m_WebApp = webapp;
 }
コード例 #14
0
 public WifiRegionManagementGetHandler(WebApp webapp) :
     base("GET", "/wifi/admin/regions")
 {
     m_WebApp = webapp;
 }
コード例 #15
0
 public WifiHyperlinkPostHandler(WebApp webapp)
     : base("POST", "/wifi/linkregion")
 {
     m_WebApp = webapp;
 }
コード例 #16
0
 public WifiConsoleHandler(WebApp webapp)
     : base("GET", "/wifi/admin/console")
 {
     m_WebApp = webapp;
 }
コード例 #17
0
 public WifiGroupsManagementGetHandler(WebApp webapp) :
     base("GET", "/wifi/admin/groups")
 {
     m_WebApp = webapp;
 }
コード例 #18
0
 public WifiInventoryGetHandler(WebApp webapp)
     : base("GET", "/wifi/user/inventory")
 {
     m_WebApp = webapp;
 }
コード例 #19
0
        private void Initialize(IHttpServer server)
        {
            m_log.DebugFormat("[Wifi]: Initializing. Server at port {0}.", server.Port);

            IConfig serverConfig = m_Config.Configs[ConfigName];

            if (serverConfig == null)
            {
                throw new Exception(String.Format("No section {0} in config file", ConfigName));
            }

            // Launch the WebApp
            m_WebApp = new WebApp(m_Config, ConfigName, m_Server, m_SceneActor);

            // Register all the handlers
            BaseStreamHandler defaultHandler = new WifiDefaultHandler(m_WebApp);

            AddStreamHandler(defaultHandler);
            AddStreamHandler(new WifiRootHandler(defaultHandler));
            AddStreamHandler(new WifiHeadHandler(m_WebApp));
            AddStreamHandler(new WifiNotifyHandler(m_WebApp));
            AddStreamHandler(new WifiInstallGetHandler(m_WebApp));
            AddStreamHandler(new WifiInstallPostHandler(m_WebApp));
            AddStreamHandler(new WifiLoginHandler(m_WebApp));
            AddStreamHandler(new WifiLogoutHandler(m_WebApp));
            AddStreamHandler(new WifiForgotPasswordGetHandler(m_WebApp));
            AddStreamHandler(new WifiForgotPasswordPostHandler(m_WebApp));
            AddStreamHandler(new WifiPasswordRecoverGetHandler(m_WebApp));
            AddStreamHandler(new WifiPasswordRecoverPostHandler(m_WebApp));
            AddStreamHandler(new WifiUserAccountGetHandler(m_WebApp));
            AddStreamHandler(new WifiUserAccountPostHandler(m_WebApp));
            AddStreamHandler(new WifiUserManagementGetHandler(m_WebApp));
            AddStreamHandler(new WifiUserManagementPostHandler(m_WebApp));
            AddStreamHandler(new WifiConsoleHandler(m_WebApp));

            AddStreamHandler(new WifiInventoryLoadGetHandler(m_WebApp));
            AddStreamHandler(new WifiInventoryGetHandler(m_WebApp));
            AddStreamHandler(new WifiInventoryPostHandler(m_WebApp));

            AddStreamHandler(new WifiHyperlinkGetHandler(m_WebApp));
            AddStreamHandler(new WifiHyperlinkPostHandler(m_WebApp));

            AddStreamHandler(new WifiTOSGetHandler(m_WebApp));
            AddStreamHandler(new WifiTOSPostHandler(m_WebApp));

            AddStreamHandler(new WifiGroupsManagementGetHandler(m_WebApp));
            AddStreamHandler(new WifiGroupsManagementPostHandler(m_WebApp));

            //server.AddStreamHandler(new WifiRegionManagementPostHandler(app));
            //server.AddStreamHandler(new WifiRegionManagementGetHandler(app));

            // Add handlers for serving configured paths
            IEnumerable <string> servePaths = serverConfig.GetKeys().Where(option => option.StartsWith(m_ServePathPrefix));

            if (servePaths.Count() > 0)
            {
                foreach (string servePath in servePaths)
                {
                    string   paths = serverConfig.GetString(servePath, string.Empty);
                    string[] parts = paths.Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries);
                    if (parts.Count() == 2)
                    {
                        AddStreamHandler(new WifiGetHandler(parts[0], parts[1]));
                    }
                    else
                    {
                        m_log.WarnFormat("[Wifi]: Invalid format with configuration option {0}: {1}", servePath, paths);
                    }
                }
            }

            // Load addons
            IEnumerable <string> addonVars = serverConfig.GetKeys().Where(option => option.StartsWith(m_AddonPrefix));

            if (addonVars.Count() > 0)
            {
                foreach (string addonVar in addonVars)
                {
                    string addonDll = serverConfig.GetString(addonVar, string.Empty);
                    if (addonDll != string.Empty)
                    {
                        m_log.InfoFormat("[Wifi]: Loading addon {0}", addonDll);
                        object[]   args  = new object[] { m_Config, ConfigName, m_Server, m_WebApp };
                        IWifiAddon addon = ServerUtils.LoadPlugin <IWifiAddon>(addonDll, args);

                        if (addon == null)
                        {
                            m_log.WarnFormat("[Wifi]: Unable to load addon {0}", addonDll);
                        }
                    }
                }
            }

            // Load Wifi addons as mono addins, if they exist
            try
            {
                AddinManager.AddExtensionNodeHandler("/Diva/Wifi/Addon", OnExtensionChanged);
            }
            catch (InvalidOperationException e)
            {
                m_log.DebugFormat("[Wifi]: extension point /Diva/Wifi/Addon not found");
            }
        }
コード例 #20
0
 public WifiNotifyHandler(WebApp webapp)
     : base("POST", "/wifi/notify")
 {
     m_WebApp = webapp;
 }
コード例 #21
0
 public WifiPasswordRecoverPostHandler(WebApp webapp) :
     base("POST", "/wifi/recover")
 {
     m_WebApp = webapp;
 }
コード例 #22
0
        public WifiScriptFace(WebApp webApp)
        {
            m_log.Debug("[WifiScriptFace]: Starting...");

            m_WebApp = webApp;
        }
コード例 #23
0
 public WifiForgotPasswordPostHandler(WebApp webapp) :
     base("POST", "/wifi/forgotpassword")
 {
     m_WebApp = webapp;
 }
コード例 #24
0
ファイル: WebApp.cs プロジェクト: kenvc/diva-distribution
        public WebApp(IConfigSource config, string configName, IHttpServer server)
        {
            ReadConfigs(config, configName);

            // Create the two parts
            Services = new Services(config, configName, this);
            WifiScriptFace = new WifiScriptFace(this);

            m_ExtensionMethods = typeof(ExtensionMethods);
            m_Statistics = new StatisticsDict();

            WebAppInstance = this;
            WifiScriptFaceInstance = WifiScriptFace;

            m_log.DebugFormat("[Wifi]: Starting with extension methods type {0}", m_ExtensionMethods);
        }
コード例 #25
0
        public WifiServerConnector(IConfigSource config, IHttpServer server, string configName, ISceneActor sactor)
            : base(config, server, configName)
        {
            m_log.DebugFormat("[Wifi]: WifiServerConnector starting");
            IConfig serverConfig = config.Configs[m_ConfigName];
            if (serverConfig == null)
                throw new Exception(String.Format("No section {0} in config file", m_ConfigName));

            //
            // Leaving this here for educational purposes
            //
            //if (Environment.StaticVariables.ContainsKey("AppDll"))
            //{
            //    object[] args = new object[] { config, server };
            //    WebApp app = ServerUtils.LoadPlugin<IWebApp>(Environment.StaticVariables["AppDll"].ToString(), args);
            //    Environment.InitializeWebApp(app);
            //}

            // Launch the WebApp
            WebApp app = new WebApp(config, m_ConfigName, server, sactor);

            // Register all the handlers
            server.AddStreamHandler(new WifiDefaultHandler(app));
            server.AddStreamHandler(new WifiHeadHandler(app));
            server.AddStreamHandler(new WifiNotifyHandler(app));
            server.AddStreamHandler(new WifiInstallGetHandler(app));
            server.AddStreamHandler(new WifiInstallPostHandler(app));
            server.AddStreamHandler(new WifiLoginHandler(app));
            server.AddStreamHandler(new WifiLogoutHandler(app));
            server.AddStreamHandler(new WifiForgotPasswordGetHandler(app));
            server.AddStreamHandler(new WifiForgotPasswordPostHandler(app));
            server.AddStreamHandler(new WifiPasswordRecoverGetHandler(app));
            server.AddStreamHandler(new WifiPasswordRecoverPostHandler(app));
            server.AddStreamHandler(new WifiUserAccountGetHandler(app));
            server.AddStreamHandler(new WifiUserAccountPostHandler(app));
            server.AddStreamHandler(new WifiUserManagementGetHandler(app));
            server.AddStreamHandler(new WifiUserManagementPostHandler(app));
            server.AddStreamHandler(new WifiConsoleHandler(app));

            server.AddStreamHandler(new WifiInventoryLoadGetHandler(app));
            server.AddStreamHandler(new WifiInventoryGetHandler(app));
            server.AddStreamHandler(new WifiInventoryPostHandler(app));

            server.AddStreamHandler(new WifiHyperlinkGetHandler(app));
            server.AddStreamHandler(new WifiHyperlinkPostHandler(app));

            server.AddStreamHandler(new WifiTOSGetHandler(app));
            server.AddStreamHandler(new WifiTOSPostHandler(app));

            server.AddStreamHandler(new WifiGroupsManagementGetHandler(app));
            server.AddStreamHandler(new WifiGroupsManagementPostHandler(app));

            //server.AddStreamHandler(new WifiRegionManagementPostHandler(app));
            //server.AddStreamHandler(new WifiRegionManagementGetHandler(app));

            // Add handlers for serving configured paths
            IEnumerable<string> servePaths = serverConfig.GetKeys().Where(option => option.StartsWith(m_ServePathPrefix));
            if (servePaths.Count() > 0)
            {
                foreach (string servePath in servePaths)
                {
                    string paths = serverConfig.GetString(servePath, string.Empty);
                    string[] parts = paths.Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries);
                    if (parts.Count() == 2)
                        server.AddStreamHandler(new WifiGetHandler(parts[0], parts[1]));
                    else
                        m_log.WarnFormat("[Wifi]: Invalid format with configuration option {0}: {1}", servePath, paths);
                }
            }

            // Load addons
            IEnumerable<string> addonVars = serverConfig.GetKeys().Where(option => option.StartsWith(m_AddonPrefix));
            if (addonVars.Count() > 0)
            {
                foreach (string addonVar in addonVars)
                {
                    string addonDll = serverConfig.GetString(addonVar, string.Empty);
                    if (addonDll != string.Empty)
                    {
                        m_log.InfoFormat("[Wifi]: Loading addon {0}", addonDll);
                        object[] args = new object[] { config, m_ConfigName, server, app };
                        IWifiAddon addon = ServerUtils.LoadPlugin<IWifiAddon>(addonDll, args);

                        if (addon == null)
                            m_log.WarnFormat("[Wifi]: Unable to load addon {0}", addonDll);
                    }
                }
            }
        }
コード例 #26
0
 public WifiDefaultHandler(WebApp webapp) :
     base("GET", "/wifi")
 {
     m_WebApp = webapp;
 }
コード例 #27
0
 public WifiConsoleHandler(WebApp webapp) :
     base("GET", "/wifi/admin/console")
 {
     m_WebApp = webapp;
 }
コード例 #28
0
 public WifiUserManagementGetHandler(WebApp webapp)
     : base("GET", "/wifi/admin/users")
 {
     m_WebApp = webapp;
 }
コード例 #29
0
ファイル: WifiTOSHandlers.cs プロジェクト: justasabc/wifi
 public WifiTOSGetHandler(WebApp webapp) :
     base("GET", "/wifi/tos")
 {
     m_WebApp = webapp;
 }
コード例 #30
0
 public WifiLoginHandler(WebApp webapp) :
     base("POST", "/wifi/login")
 {
     m_WebApp = webapp;
 }
コード例 #31
0
ファイル: WifiTOSHandlers.cs プロジェクト: justasabc/wifi
 public WifiTOSPostHandler(WebApp webapp) :
     base("POST", "/wifi/tos")
 {
     m_WebApp = webapp;
 }
コード例 #32
0
 public WifiHyperlinkGetHandler(WebApp webapp)
     : base("GET", "/wifi/linkregion")
 {
     m_WebApp = webapp;
 }
コード例 #33
0
 public WifiUserAccountGetHandler(WebApp webapp) :
     base("GET", "/wifi/user/account")
 {
     m_WebApp = webapp;
 }
コード例 #34
0
 public WifiInstallGetHandler(WebApp webapp) :
         base("GET", "/wifi/install")
 {
     m_WebApp = webapp;
 }
コード例 #35
0
 public WifiGroupsManagementGetHandler(WebApp webapp)
     : base("GET", "/wifi/admin/groups")
 {
     m_WebApp = webapp;
 }
コード例 #36
0
 public WifiInventoryPostHandler(WebApp webapp)
     : base("POST", "/wifi/user/inventory")
 {
     m_WebApp = webapp;
 }
コード例 #37
0
ファイル: WifiInstallHandlers.cs プロジェクト: justasabc/wifi
 public WifiInstallGetHandler(WebApp webapp) :
     base("GET", "/wifi/install")
 {
     m_WebApp = webapp;
 }
コード例 #38
0
 public WifiLoginHandler(WebApp webapp)
     : base("POST", "/wifi/login")
 {
     m_WebApp = webapp;
 }
コード例 #39
0
ファイル: WifiInstallHandlers.cs プロジェクト: justasabc/wifi
 public WifiInstallPostHandler(WebApp webapp) :
     base("POST", "/wifi/install")
 {
     m_WebApp = webapp;
 }
コード例 #40
0
 public WifiRegionManagementGetHandler(WebApp webapp)
     : base("GET", "/wifi/admin/regions")
 {
     m_WebApp = webapp;
 }
コード例 #41
0
 public WifiPasswordRecoverPostHandler(WebApp webapp)
     : base("POST", "/wifi/recover")
 {
     m_WebApp = webapp;
 }
コード例 #42
0
 public WifiTOSPostHandler(WebApp webapp)
     : base("POST", "/wifi/tos")
 {
     m_WebApp = webapp;
 }
コード例 #43
0
 public WifiForgotPasswordGetHandler(WebApp webapp)
     : base("GET", "/wifi/forgotpassword")
 {
     m_WebApp = webapp;
 }
コード例 #44
0
 public WifiDefaultHandler(WebApp webapp)
     : base("GET", "/wifi")
 {
     m_WebApp = webapp;
 }
コード例 #45
0
 public WifiUserAccountGetHandler(WebApp webapp)
     : base("GET", "/wifi/user/account")
 {
     m_WebApp = webapp;
 }
コード例 #46
0
 public WifiLogoutHandler(WebApp webapp)
     : base("GET", "/wifi/logout")
 {
     m_WebApp = webapp;
 }
コード例 #47
0
 public WifiNotifyHandler(WebApp webapp) :
     base("POST", "/wifi/notify")
 {
     m_WebApp = webapp;
 }