当前位置: 首页>>代码示例>>C#>>正文


C# IHttpServer.AddHTTPHandler方法代码示例

本文整理汇总了C#中IHttpServer.AddHTTPHandler方法的典型用法代码示例。如果您正苦于以下问题:C# IHttpServer.AddHTTPHandler方法的具体用法?C# IHttpServer.AddHTTPHandler怎么用?C# IHttpServer.AddHTTPHandler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IHttpServer的用法示例。


在下文中一共展示了IHttpServer.AddHTTPHandler方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SimulationServiceInConnector

        public SimulationServiceInConnector(IConfigSource config, IHttpServer server, IScene scene) :
                base(config, server, String.Empty)
        {
            //IConfig serverConfig = config.Configs["SimulationService"];
            //if (serverConfig == null)
            //    throw new Exception("No section 'SimulationService' in config file");

            //string simService = serverConfig.GetString("LocalServiceModule",
            //        String.Empty);

            //if (simService == String.Empty)
            //    throw new Exception("No SimulationService in config file");

            //Object[] args = new Object[] { config };
            m_LocalSimulationService = scene.RequestModuleInterface<ISimulationService>();
            m_LocalSimulationService = m_LocalSimulationService.GetInnerService();
                    //ServerUtils.LoadPlugin<ISimulationService>(simService, args);

            //System.Console.WriteLine("XXXXXXXXXXXXXXXXXXX m_AssetSetvice == null? " + ((m_AssetService == null) ? "yes" : "no"));
            //server.AddStreamHandler(new AgentGetHandler(m_SimulationService, m_AuthenticationService));
            //server.AddStreamHandler(new AgentPostHandler(m_SimulationService, m_AuthenticationService));
            //server.AddStreamHandler(new AgentPutHandler(m_SimulationService, m_AuthenticationService));
            //server.AddStreamHandler(new AgentDeleteHandler(m_SimulationService, m_AuthenticationService));
            server.AddHTTPHandler("/agent/", new AgentHandler(m_LocalSimulationService).Handler);
            server.AddHTTPHandler("/object/", new ObjectHandler(m_LocalSimulationService).Handler);

            //server.AddStreamHandler(new ObjectPostHandler(m_SimulationService, authentication));
        }
开发者ID:AlexRa,项目名称:opensim-mods-Alex,代码行数:28,代码来源:SimulationServiceInConnector.cs

示例2: SetServer

        public void SetServer(IHttpServer server)
        {
            m_Server = server;

            m_Server.AddHTTPHandler("/StartSession/", HandleHttpStartSession);
            m_Server.AddHTTPHandler("/CloseSession/", HandleHttpCloseSession);
            m_Server.AddHTTPHandler("/SessionCommand/", HandleHttpSessionCommand);
        }
开发者ID:Ideia-Boa,项目名称:diva-distribution,代码行数:8,代码来源:RemoteConsole.cs

示例3: SimulationServiceInConnector

//        private IAuthenticationService m_AuthenticationService;

        public SimulationServiceInConnector(IConfigSource config, IHttpServer server, IScene scene) :
                base(config, server, String.Empty)
        {
            m_LocalSimulationService = scene.RequestModuleInterface<ISimulationService>();
            m_LocalSimulationService = m_LocalSimulationService.GetInnerService();

            // This one MUST be a stream handler because compressed fatpacks
            // are pure binary and shoehorning that into a string with UTF-8
            // encoding breaks it
            server.AddStreamHandler(new AgentPostHandler(m_LocalSimulationService));
            server.AddStreamHandler(new AgentPutHandler(m_LocalSimulationService));
            server.AddHTTPHandler("/agent/", new AgentHandler(m_LocalSimulationService).Handler);
            server.AddHTTPHandler("/object/", new ObjectHandler(m_LocalSimulationService).Handler);
        }
开发者ID:BogusCurry,项目名称:arribasim-dev,代码行数:16,代码来源:SimulationServiceInConnector.cs

示例4: FinishedStartup

 public void FinishedStartup()
 {
     _server = _registry.RequestModuleInterface<ISimulationBase>().GetHttpServer(0);
     if (_server != null)
     {
         _server.AddHTTPHandler("GridTexture", OnHTTPGetTextureImage);
         _registry.RegisterModuleInterface<IWebHttpTextureService>(this);
     }
     IGridInfo gridInfo = _registry.RequestModuleInterface<IGridInfo>();
     _gridNick = gridInfo != null ? gridInfo.GridName :
         "No Grid Name Available, please set this";
 }
开发者ID:rjspence,项目名称:YourSim,代码行数:12,代码来源:WebHttpTextureService.cs

示例5: Initialize

        public void Initialize(IConfigSource config, IRegistryCore registry)
        {
            m_registry = registry;
            IConfig mapConfig = config.Configs["MapService"];
            if (mapConfig != null)
            {
                m_enabled = mapConfig.GetBoolean("Enabled", m_enabled);
                m_port = mapConfig.GetUInt("Port", m_port);
                m_cacheEnabled = mapConfig.GetBoolean("CacheEnabled", m_cacheEnabled);
                m_cacheExpires = mapConfig.GetFloat("CacheExpires", m_cacheExpires);
            }
            if (!m_enabled)
                return;

            if (m_cacheEnabled)
                CreateCacheDirectories();

            m_server = registry.RequestModuleInterface<ISimulationBase>().GetHttpServer(m_port);
            m_server.AddHTTPHandler(new GenericStreamHandler("GET", "/MapService/", MapRequest));
            m_server.AddHTTPHandler(new GenericStreamHandler("GET", "/MapAPI/", MapAPIRequest));

            registry.RegisterModuleInterface<IMapService>(this);

            m_blankRegionTile = new Bitmap(256, 256);
            m_blankRegionTile.Tag = "StaticBlank";
            using (Graphics g = Graphics.FromImage(m_blankRegionTile))
            {
                SolidBrush sea = new SolidBrush(Color.FromArgb(29, 71, 95));
                g.FillRectangle(sea, 0, 0, 256, 256);
            }
            m_blankRegionTileData = CacheMapTexture(1, 0, 0, m_blankRegionTile, true);
            /*string path = Path.Combine("assetcache", Path.Combine("mapzoomlevels", "blankMap.index"));
            if(File.Exists(path))
            {
                FileStream stream = File.OpenRead(path);
                m_blankTiles = ProtoBuf.Serializer.Deserialize<MapTileIndex>(stream);
                stream.Close();
            }*/
        }
开发者ID:velus,项目名称:Async-Sim-Testing,代码行数:39,代码来源:MapService.cs

示例6: FreeswitchServerConnector

        public FreeswitchServerConnector(IConfigSource config, IHttpServer server, string configName) :
                base(config, server, configName)
        {
            if (configName != String.Empty)
                m_ConfigName = configName;

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

            string freeswitchService = serverConfig.GetString("LocalServiceModule",
                    String.Empty);

            if (freeswitchService == String.Empty)
                throw new Exception("No LocalServiceModule in config file");

            Object[] args = new Object[] { config };
            m_FreeswitchService =
                    ServerUtils.LoadPlugin<IFreeswitchService>(freeswitchService, args);

            server.AddHTTPHandler(String.Format("{0}/freeswitch-config", m_freeSwitchAPIPrefix), FreeSwitchConfigHTTPHandler);
            server.AddHTTPHandler(String.Format("{0}/region-config", m_freeSwitchAPIPrefix), RegionConfigHTTPHandler);
        }
开发者ID:BogusCurry,项目名称:arribasim-dev,代码行数:23,代码来源:FreeswitchServerConnector.cs

示例7: Initialize

        public void Initialize (IConfigSource config, IRegistryCore registry)
        {
            m_registry = registry;
            IConfig mapConfig = config.Configs["MapService"];
            if (mapConfig != null)
            {
                m_enabled = mapConfig.GetBoolean ("Enabled", m_enabled);
                m_port = mapConfig.GetUInt ("Port", m_port);
                m_cacheEnabled = mapConfig.GetBoolean ("CacheEnabled", m_cacheEnabled);
                m_cacheExpires = mapConfig.GetFloat ("CacheExpires", m_cacheExpires);
            }
            if(!m_enabled)
                return;

            if (m_cacheEnabled)
                CreateCacheDirectories ();

            m_server = registry.RequestModuleInterface<ISimulationBase>().GetHttpServer(m_port);
            m_server.AddHTTPHandler("/MapService/", MapRequest);
            m_server.AddHTTPHandler(new GenericStreamHandler("GET", "/MapAPI/", MapAPIRequest));

            registry.RegisterModuleInterface<IMapService>(this);
        }
开发者ID:rjspence,项目名称:YourSim,代码行数:23,代码来源:MapService.cs

示例8: GatekeeperServiceInConnector

        public GatekeeperServiceInConnector(IConfigSource config, IHttpServer server, ISimulationService simService) :
                base(config, server, String.Empty)
        {
            IConfig gridConfig = config.Configs["GatekeeperService"];
            if (gridConfig != null)
            {
                string serviceDll = gridConfig.GetString("LocalServiceModule", string.Empty);
                Object[] args = new Object[] { config, simService };
                m_GatekeeperService = ServerUtils.LoadPlugin<IGatekeeperService>(serviceDll, args);

            }
            if (m_GatekeeperService == null)
                throw new Exception("Gatekeeper server connector cannot proceed because of missing service");

            HypergridHandlers hghandlers = new HypergridHandlers(m_GatekeeperService);
            server.AddXmlRPCHandler("link_region", hghandlers.LinkRegionRequest, false);
            server.AddXmlRPCHandler("get_region", hghandlers.GetRegion, false);

            server.AddHTTPHandler("/foreignagent/", new GatekeeperAgentHandler(m_GatekeeperService).Handler);
        }
开发者ID:AlexRa,项目名称:opensim-mods-Alex,代码行数:20,代码来源:GatekeeperServerConnector.cs

示例9: UserAgentServerConnector

        public UserAgentServerConnector(IConfigSource config, IHttpServer server) :
                base(config, server, String.Empty)
        {
            IConfig gridConfig = config.Configs["UserAgentService"];
            if (gridConfig != null)
            {
                string serviceDll = gridConfig.GetString("LocalServiceModule", string.Empty);
                Object[] args = new Object[] { config };
                m_HomeUsersService = ServerUtils.LoadPlugin<IUserAgentService>(serviceDll, args);
            }
            if (m_HomeUsersService == null)
                throw new Exception("UserAgent server connector cannot proceed because of missing service");

            server.AddXmlRPCHandler("agent_is_coming_home", AgentIsComingHome, false);
            server.AddXmlRPCHandler("get_home_region", GetHomeRegion, false);
            server.AddXmlRPCHandler("verify_agent", VerifyAgent, false);
            server.AddXmlRPCHandler("verify_client", VerifyClient, false);
            server.AddXmlRPCHandler("logout_agent", LogoutAgent, false);

            server.AddHTTPHandler("/homeagent/", new HomeAgentHandler(m_HomeUsersService).Handler);
        }
开发者ID:AlexRa,项目名称:opensim-mods-Alex,代码行数:21,代码来源:UserAgentServerConnector.cs

示例10: SetServer

        public void SetServer(IHttpServer server)
        {
            m_Server = server;

            m_Server.AddHTTPHandler(new GenericStreamHandler("GET", "/StartSession/", HandleHttpStartSession));
            m_Server.AddHTTPHandler(new GenericStreamHandler("GET", "/CloseSession/", HandleHttpCloseSession));
            m_Server.AddHTTPHandler(new GenericStreamHandler("GET", "/SessionCommand/", HandleHttpSessionCommand));
        }
开发者ID:velus,项目名称:Async-Sim-Testing,代码行数:8,代码来源:RemoteConsole.cs

示例11: Start

        public void Start(IConfigSource config, IRegistryCore registry)
        {
            m_connector = DataManager.DataManager.RequestPlugin<WebAPIConnector>();
            if (m_connector == null || m_connector.Enabled == false || m_connector.Handler != Name)
            {
                return;
            }

            IConfig handlerConfig = config.Configs["Handlers"];
            UUID.TryParse(handlerConfig.GetString("WebAPIAdminID", UUID.Zero.ToString()), out AdminAgentID);

            if (m_connector.Handler != Name)
            {
                MainConsole.Instance.Warn("[WebAPI]: module not loaded");
                return;
            }
            MainConsole.Instance.Info("[WebAPI]: module loaded");

            m_registry = registry;

            IConfig GridInfoConfig = config.Configs["GridInfoService"];
            if (GridInfoConfig != null)
            {
                m_servernick = GridInfoConfig.GetString("gridnick", m_servernick);
            }

            m_GridInfo = new OSDMap();
            if (GridInfoConfig != null && (GridInfoConfig.GetString("gridname", "") != "" && GridInfoConfig.GetString("gridnick", "") != ""))
            {
                foreach (string k in GridInfoConfig.GetKeys())
                {
                    m_GridInfo[k] = GridInfoConfig.GetString(k);
                }
            }

            ISimulationBase simBase = registry.RequestModuleInterface<ISimulationBase>();

            m_server = simBase.GetHttpServer(handlerConfig.GetUInt(Name + "Port", m_connector.HandlerPort));
            foreach (WebAPIHttpMethod method in Enum.GetValues(typeof(WebAPIHttpMethod)))
            {
                m_server.AddStreamHandler(new WebAPI_StreamHandler(this, method)); // This handler is for WebAPI methods that only read data
            }

            m_server2 = simBase.GetHttpServer(handlerConfig.GetUInt(Name + "TextureServerPort", m_connector.TexturePort));
            m_server2.AddHTTPHandler("GridTexture", OnHTTPGetTextureImage);

            m_GridInfo[Name + "TextureServer"] = m_server2.ServerURI;

            m_authNonces = new ExpiringCache<string, string>();

            MainConsole.Instance.Commands.AddCommand("webapi promote user", "Grants the specified user administrative powers within WebAPI.", "webapi promote user", PromoteUser);
            MainConsole.Instance.Commands.AddCommand("webapi demote user", "Revokes administrative powers for WebAPI from the specified user.", "webapi demote user", DemoteUser);
            MainConsole.Instance.Commands.AddCommand("webapi add group as news source", "Sets a group as a news source so in-world group notices can be used as a publishing tool for the website.", "webapi add group as news source", AddGroupAsNewsSource);
            MainConsole.Instance.Commands.AddCommand("webapi remove group as news source", "Removes a group as a news source so it's notices will stop showing up on the news page.", "webapi remove group as news source", RemoveGroupAsNewsSource);
            MainConsole.Instance.Commands.AddCommand("webapi list methods", "List API methods", "webapi list methods", ListAPImethods);
            MainConsole.Instance.Commands.AddCommand("webapi get access token", "Gets the current access token to the API for the specified user", "webapi get access token", GetAccessToken);
            MainConsole.Instance.Commands.AddCommand("webapi get new access token", "Gets a new access token to the API for the specified user", "webapi get new access token", GetNewAccessToken);
            MainConsole.Instance.Commands.AddCommand("webapi clear log", "Clears the API access log", "webapi clear log [staleonly]", ClearLog);
            MainConsole.Instance.Commands.AddCommand("webapi get usage rate", "Get the current usage rate for the specified user on the specified method.", "webapi get usage rate", GetUsageRate);
            MainConsole.Instance.Commands.AddCommand("webapi grant access", "Grants access to a specified method for a specified user.", "webapi grant access [method]", GrantAPIAccess);
            MainConsole.Instance.Commands.AddCommand("webapi revoke access", "Revokes access for a specified user.", "webapi revoke access", RevokeAPIAccess);
            MainConsole.Instance.Commands.AddCommand("webapi reset access", "Resets access to defaults for a specified method for a specified user.", "webapi reset access", ResetAPIAccess);
        }
开发者ID:KSLcom,项目名称:Aurora-WebAPI,代码行数:63,代码来源:WebAPIHandler.cs

示例12: Start

        public void Start(IConfigSource config, IRegistryCore registry)
        {
            if (config.Configs["GridInfoService"] != null)
                m_servernick = config.Configs["GridInfoService"].GetString("gridnick", m_servernick);
            m_registry = registry;
            IConfig handlerConfig = config.Configs["Handlers"];
            string name = handlerConfig.GetString("WireduxHandler", "");
            if (name != Name)
                return;
            string Password = handlerConfig.GetString("WireduxHandlerPassword", String.Empty);
            if (Password != "")
            {
                m_server = registry.RequestModuleInterface<ISimulationBase>().GetHttpServer(handlerConfig.GetUInt("WireduxHandlerPort"));
                //This handler allows sims to post CAPS for their sims on the CAPS server.
                m_server.AddStreamHandler(new WireduxHTTPHandler(Password, registry));
                m_server2 = registry.RequestModuleInterface<ISimulationBase>().GetHttpServer(handlerConfig.GetUInt("WireduxTextureServerPort"));
                m_server2.AddHTTPHandler("GridTexture", OnHTTPGetTextureImage);
                m_server2.AddHTTPHandler("MapTexture", OnHTTPGetMapImage);

                MainConsole.Instance.Commands.AddCommand ("webui add user", "Adds an admin user for WebUI", "webui add user", AddUser);
                MainConsole.Instance.Commands.AddCommand ("webui remove user", "Removes an admin user for WebUI", "webui add user", RemoveUser);
            }
        }
开发者ID:MattoDestiny,项目名称:Aurora-WebUI,代码行数:23,代码来源:WebUIHandler.cs

示例13: Start

        public void Start(IConfigSource config, IRegistryCore registry)
        {
            m_registry = registry;

            IConfig handlerConfig = config.Configs["Handlers"];
            string name = handlerConfig.GetString(Name, "");

            if (name != Name)
            {
                MainConsole.Instance.Warn("[MapAPI] module not loaded");
                return;
            }
            MainConsole.Instance.Info("[MapAPI] module loaded");

            ISimulationBase simBase = registry.RequestModuleInterface<ISimulationBase>();

            m_textureServer = simBase.GetHttpServer(handlerConfig.GetUInt(Name + "TextureServerPort", 8002));
            m_textureServer.AddHTTPHandler(urlMapTexture, OnHTTPGetMapImage);

            m_server = simBase.GetHttpServer(handlerConfig.GetUInt(Name + "Port", 8007));
            m_server.AddStreamHandler(new MapAPIHTTPHandler_GET(this, registry, m_textureServer));

        }
开发者ID:SignpostMarv,项目名称:mapapi.cs,代码行数:23,代码来源:MapAPIHandler.cs

示例14: Start

        public void Start(IConfigSource config, IRegistryCore registry)
        {
            if (config.Configs["GridInfoService"] != null)
                m_servernick = config.Configs["GridInfoService"].GetString("gridnick", m_servernick);
            m_registry = registry;
            IConfig handlerConfig = config.Configs["Handlers"];
            string name = handlerConfig.GetString("WireduxHandler", "");
            if (name != Name)
                return;
            string Password = handlerConfig.GetString("WireduxHandlerPassword", String.Empty);
            if (Password != "")
            {
                IConfig gridCfg = config.Configs["GridInfoService"];
                OSDMap gridInfo = new OSDMap();
                if (gridCfg != null)
                {
                    if (gridCfg.GetString("gridname", "") != "" && gridCfg.GetString("gridnick", "") != "")
                    {
                        foreach (string k in gridCfg.GetKeys())
                        {
                            gridInfo[k] = gridCfg.GetString(k);
                        }
                    }
                }

                m_server = registry.RequestModuleInterface<ISimulationBase>().GetHttpServer(handlerConfig.GetUInt("WireduxHandlerPort"));
                //This handler allows sims to post CAPS for their sims on the CAPS server.
                m_server.AddStreamHandler(new WireduxHTTPHandler(Password, registry, gridInfo, UUID.Zero));
                m_server2 = registry.RequestModuleInterface<ISimulationBase>().GetHttpServer(handlerConfig.GetUInt("WireduxTextureServerPort"));
                m_server2.AddHTTPHandler("GridTexture", OnHTTPGetTextureImage);
                m_server2.AddHTTPHandler("MapTexture", OnHTTPGetMapImage);
                gridInfo["WireduxTextureServer"] = m_server2.ServerURI;

                MainConsole.Instance.Commands.AddCommand("webui promote user", "Grants the specified user administrative powers within webui.", "webui promote user", PromoteUser);
                MainConsole.Instance.Commands.AddCommand("webui demote user", "Revokes administrative powers for webui from the specified user.", "webui demote user", DemoteUser);
                MainConsole.Instance.Commands.AddCommand("webui add user", "Deprecated alias for webui promote user.", "webui add user", PromoteUser);
                MainConsole.Instance.Commands.AddCommand("webui remove user", "Deprecated alias for webui demote user.", "webui remove user", DemoteUser);
            }
        }
开发者ID:EnricoNirvana,项目名称:Aurora-Sim-Joomla,代码行数:39,代码来源:WebUIHandler.cs

示例15: Start

 public void Start(IConfigSource config, IRegistryCore registry)
 {
     IConfig handlerConfig = config.Configs["Handlers"];
     if (config.Configs["GridInfoService"] != null)
         m_servernick = config.Configs["GridInfoService"].GetString("gridnick", m_servernick);
     m_registry = registry;
     if (handlerConfig.GetString("WireduxHandler", "") != Name)
         return;
     string Password = handlerConfig.GetString("WireduxHandlerPassword", String.Empty);
     if (Password != "")
     {
         m_server = registry.RequestModuleInterface<ISimulationBase>().GetHttpServer(handlerConfig.GetUInt("WireduxHandlerPort"));
         //This handler allows sims to post CAPS for their sims on the CAPS server.
         m_server.AddStreamHandler(new WireduxHTTPHandler(Password, registry));
         m_server2 = registry.RequestModuleInterface<ISimulationBase>().GetHttpServer(handlerConfig.GetUInt("WireduxTextureServerPort"));
         m_server2.AddHTTPHandler("GridTexture", OnHTTPGetTextureImage);
         m_server2.AddHTTPHandler("MapTexture", OnHTTPGetMapImage);
     }
 }
开发者ID:EnricoNirvana,项目名称:Aurora-WebUI,代码行数:19,代码来源:WebUIHandler.cs


注:本文中的IHttpServer.AddHTTPHandler方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。