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));
        }
        public XInventoryInConnector(IConfigSource config, IHttpServer server, string configName) :
                base(config, server, configName)
        {
            if (configName != String.Empty)
                m_ConfigName = configName;

            m_log.DebugFormat("[XInventoryInConnector]: Starting with config name {0}", m_ConfigName);

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

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

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

            Object[] args = new Object[] { config, m_ConfigName };
            m_InventoryService =
                    ServerUtils.LoadPlugin<IInventoryService>(inventoryService, args);

            IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName);

            server.AddStreamHandler(new XInventoryConnectorPostHandler(m_InventoryService, auth));
        }
예제 #3
0
        public void Start(IScene scene)
        {
            m_scene = scene;

            m_scheduler = scene.Simian.GetAppModule<IScheduler>();
            if (m_scheduler == null)
            {
                m_log.Warn("EventQueueManager requires an IScheduler");
                return;
            }

            m_httpServer = m_scene.Simian.GetAppModule<IHttpServer>();
            if (m_httpServer == null)
            {
                m_log.Warn("Upload requires an IHttpServer");
                return;
            }

            m_scene.Capabilities.AddProtectedResource(m_scene.ID, "EventQueueGet", EventQueueHandler);

            m_udp = m_scene.GetSceneModule<LLUDP>();
            if (m_udp != null)
            {
                m_running = true;
                m_scheduler.StartThread(EventQueueManagerThread, "EventQueue Manager (" + scene.Name + ")", ThreadPriority.Normal, false);
            }
        }
        public OpenIdServerConnector(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));

            string authService = serverConfig.GetString("AuthenticationServiceModule",
                    String.Empty);
            string userService = serverConfig.GetString("UserAccountServiceModule",
                    String.Empty);

            if (authService == String.Empty || userService == String.Empty)
                throw new Exception("No AuthenticationServiceModule or no UserAccountServiceModule in config file for OpenId authentication");

            Object[] args = new Object[] { config };
            m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authService, args);
            m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(userService, args);

            // Handler for OpenID user identity pages
            server.AddStreamHandler(new OpenIdStreamHandler("GET", "/users/", m_UserAccountService, m_AuthenticationService));
            // Handlers for the OpenID endpoint server
            server.AddStreamHandler(new OpenIdStreamHandler("POST", "/openid/server/", m_UserAccountService, m_AuthenticationService));
            server.AddStreamHandler(new OpenIdStreamHandler("GET", "/openid/server/", m_UserAccountService, m_AuthenticationService));

            m_log.Info("[OPENID]: OpenId service enabled");
        }
예제 #5
0
        public MapAddServiceConnector(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));

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

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

            Object[] args = new Object[] { config };
            m_MapService = ServerUtils.LoadPlugin<IMapImageService>(mapService, args);

            string gridService = serverConfig.GetString("GridService", String.Empty);
            if (gridService != string.Empty)
                m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);

            if (m_GridService != null)
                m_log.InfoFormat("[MAP IMAGE HANDLER]: GridService check is ON");
            else
                m_log.InfoFormat("[MAP IMAGE HANDLER]: GridService check is OFF");

            bool proxy = serverConfig.GetBoolean("HasProxy", false);
            IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName);
            server.AddStreamHandler(new MapServerPostHandler(m_MapService, m_GridService, proxy, auth));

        }
예제 #6
0
 public void SetUp()
 {
     _hostUrl = HostHelper.GenerateAHostUrlForAStubServer();
     _httpMockRepository = HttpMockRepository.At(_hostUrl);
     _wc = new WebClient();
     _stubHttp = _httpMockRepository.WithNewContext();
 }
예제 #7
0
 private void InitializeHandlers(IHttpServer server)
 {
     LLLoginHandlers loginHandlers = new LLLoginHandlers(m_LoginService, m_Config, m_Proxy);
     server.AddXmlRPCHandler("login_to_simulator", loginHandlers.HandleXMLRPCLogin, false);
     server.AddXmlRPCHandler("set_login_level", loginHandlers.HandleXMLRPCSetLoginLevel, false);
     server.SetDefaultLLSDHandler(loginHandlers.HandleLLSDLogin);
 }
예제 #8
0
파일: Upload.cs 프로젝트: thoys/simian
        public void Start(IScene scene)
        {
            m_scene = scene;

            m_assetClient = m_scene.Simian.GetAppModule<IAssetClient>();
            if (m_assetClient == null)
            {
                m_log.Warn("Upload requires an IAssetClient");
                return;
            }

            m_httpServer = m_scene.Simian.GetAppModule<IHttpServer>();
            if (m_httpServer == null)
            {
                m_log.Warn("Upload requires an IHttpServer");
                return;
            }

            m_primMesher = m_scene.GetSceneModule<IPrimMesher>();
            m_permissions = m_scene.GetSceneModule<LLPermissions>();

            m_scene.Capabilities.AddProtectedResource(m_scene.ID, "UploadBakedTexture", UploadBakedTextureHandler);
            m_scene.Capabilities.AddProtectedResource(m_scene.ID, "UploadBakedTextureData", UploadBakedTextureDataHandler);
            m_scene.Capabilities.AddProtectedResource(m_scene.ID, "UploadObjectAsset", UploadObjectAssetHandler);
        }
 public TwitterSearchService(IHttpRequestResponse httpRequestResponse, IOAuthCreationService oAuthCreationService, IMapUser mapUser, IHttpServer httpServer, IMapSearch mapSearch)
 {
     _httpRequestResponse = httpRequestResponse;
     _oAuthCreationService = oAuthCreationService;
     _httpServer = httpServer;
     _mapSearch = mapSearch;
 }
        public FetchInventory2ServerConnector(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 invService = serverConfig.GetString("InventoryService", String.Empty);

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

            Object[] args = new Object[] { config };
            m_InventoryService = ServerUtils.LoadPlugin<IInventoryService>(invService, args);

            if (m_InventoryService == null)
                throw new Exception(String.Format("Failed to load InventoryService from {0}; config is {1}", invService, m_ConfigName));

            FetchInventory2Handler fiHandler = new FetchInventory2Handler(m_InventoryService);
            IRequestHandler reqHandler
                = new RestStreamHandler("POST", "/CAPS/FetchInventory/", fiHandler.FetchInventoryRequest);
            server.AddStreamHandler(reqHandler);
        }
        public WebFetchInvDescServerConnector(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 invService = serverConfig.GetString("InventoryService", String.Empty);

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

            Object[] args = new Object[] { config };
            m_InventoryService =
                    ServerUtils.LoadPlugin<IInventoryService>(invService, args);

            if (m_InventoryService == null)
                throw new Exception(String.Format("Failed to load InventoryService from {0}; config is {1}", invService, m_ConfigName));

            string libService = serverConfig.GetString("LibraryService", String.Empty);
            m_LibraryService =
                    ServerUtils.LoadPlugin<ILibraryService>(libService, args);

            WebFetchInvDescHandler webFetchHandler = new WebFetchInvDescHandler(m_InventoryService, m_LibraryService);
            IRequestHandler reqHandler = new RestStreamHandler("POST", "/CAPS/WebFetchInvDesc/" /*+ UUID.Random()*/, webFetchHandler.FetchInventoryDescendentsRequest);
            server.AddStreamHandler(reqHandler);
        }
        public GetTextureServerConnector(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 assetService = serverConfig.GetString("AssetService", String.Empty);

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

            Object[] args = new Object[] { config };
            m_AssetService =
                    ServerUtils.LoadPlugin<IAssetService>(assetService, args);

            if (m_AssetService == null)
                throw new Exception(String.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName));

            string rurl = serverConfig.GetString("GetTextureRedirectURL");
            ;
            server.AddStreamHandler(
                new GetTextureHandler("/CAPS/GetTexture/" /*+ UUID.Random() */, m_AssetService, "GetTexture", null, rurl));
        }
        public UploadBakedTextureServerConnector(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 assetService = serverConfig.GetString("AssetService", String.Empty);

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

            Object[] args = new Object[] { config };
            m_AssetService =
                    ServerUtils.LoadPlugin<IAssetService>(assetService, args);

            if (m_AssetService == null)
                throw new Exception(String.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName));

            // NEED TO FIX THIS
            OpenSim.Framework.Capabilities.Caps caps = new OpenSim.Framework.Capabilities.Caps(server, "", server.Port, "", UUID.Zero, "");
            server.AddStreamHandler(new RestStreamHandler(
                        "POST",
                        "/CAPS/UploadBakedTexture/",
                        new UploadBakedTextureHandler(caps, m_AssetService, true).UploadBakedTexture,
                        "UploadBakedTexture",
                        "Upload Baked Texture Capability"));

         }
예제 #14
0
        public AssetServerConnector(IConfigSource config, IHttpServer server) :
            base(config, server, "AssetService")
        {
            IConfig serverConfig = config.Configs["AssetService"];
            if (serverConfig == null)
                throw new Exception("No AssetService section in config file");

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

            if (String.IsNullOrEmpty(assetService))
                throw new Exception("No LocalServiceModule in AssetService section in config file");

            Object[] args = new Object[] { config };
            m_AssetService = ServerUtils.LoadPlugin<IAssetService>(assetService, args);

            if (m_AssetService == null)
                throw new Exception("Failed to load IAssetService \"" + assetService + "\"");

            // Asset service endpoints
            server.AddStreamHandler(new TrustedStreamHandler("GET", "/assets", new CBAssetServerGetHandler(m_AssetService)));
            server.AddStreamHandler(new TrustedStreamHandler("POST", "/assets", new CBAssetServerPostHandler(m_AssetService)));
            server.AddStreamHandler(new TrustedStreamHandler("DELETE", "/assets", new CBAssetServerDeleteHandler(m_AssetService)));

            // Register this server connector as a Cable Beach service
            CableBeachServerState.RegisterService(new Uri(CableBeachServices.ASSETS), CreateCapabilitiesHandler);

            CableBeachServerState.Log.Info("[CABLE BEACH ASSETS]: AssetServerConnector is running");
        }
        public InventoryServiceInConnector(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 inventoryService = serverConfig.GetString("LocalServiceModule",
                    String.Empty);

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

            Object[] args = new Object[] { config };
            m_InventoryService =
                    ServerUtils.LoadPlugin<IInventoryService>(inventoryService, args);

            m_userserver_url = serverConfig.GetString("UserServerURI", String.Empty);
            m_doLookup = serverConfig.GetBoolean("SessionAuthentication", false);

            AddHttpHandlers(server);
            m_log.Debug("[INVENTORY HANDLER]: handlers initialized");
        }
예제 #16
0
        public void Start(IScene scene)
        {
            m_scene = scene;

            m_httpServer = m_scene.Simian.GetAppModule<IHttpServer>();
            if (m_httpServer == null)
            {
                m_log.Warn("NewFileAgentInventory requires an IHttpServer");
                return;
            }

            m_assetClient = m_scene.Simian.GetAppModule<IAssetClient>();
            if (m_assetClient == null)
            {
                m_log.Warn("NewFileAgentInventory requires an IAssetClient");
                return;
            }

            m_inventoryClient = m_scene.Simian.GetAppModule<IInventoryClient>();
            if (m_inventoryClient == null)
            {
                m_log.Warn("NewFileAgentInventory requires an IInventoryClient");
            }

            m_permissions = m_scene.GetSceneModule<LLPermissions>();

            //m_scene.Capabilities.AddProtectedResource(m_scene.ID, "NewFileAgentInventory", NewFileAgentInventoryHandler);
            m_scene.Capabilities.AddProtectedResource(m_scene.ID, "NewFileAgentInventoryVariablePrice", NewFileAgentInventoryVariablePriceHandler);
        }
예제 #17
0
        public XBakesConnector(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 assetService = serverConfig.GetString("LocalServiceModule",
                    String.Empty);

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

            Object[] args = new Object[] { config };
            m_BakesService =
                    ServerUtils.LoadPlugin<IBakedTextureService>(assetService, args);

            IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName);
            
            server.AddStreamHandler(new BakesServerGetHandler(m_BakesService, auth));
            server.AddStreamHandler(new BakesServerPostHandler(m_BakesService, auth));
        }
        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));
        }
예제 #19
0
        public void Start(IConfigSource config, IRegistryCore registry)
        {
            ISimulationBase simBase = registry.RequestModuleInterface<ISimulationBase>();
            m_server = simBase.GetHttpServer(0);

            MainConsole.Instance.Commands.AddCommand("CapsService", false, "show presences", "show presences", "Shows all presences in the grid", ShowUsers);
        }
예제 #20
0
        private OSDMap EventManager_OnRegisterCaps(UUID agentID, IHttpServer server)
        {
            OSDMap retVal = new OSDMap();
            retVal["EnvironmentSettings"] = CapsUtil.CreateCAPS("EnvironmentSettings", "");
#if (!ISWIN)
            //Sets the windlight settings
            server.AddStreamHandler(new RestHTTPHandler("POST", retVal["EnvironmentSettings"],
                                                      delegate(Hashtable m_dhttpMethod)
                                                      {
                                                          return SetEnvironment(m_dhttpMethod, agentID);
                                                      }));
            //Sets the windlight settings
            server.AddStreamHandler(new RestHTTPHandler("GET", retVal["EnvironmentSettings"],
                                                      delegate(Hashtable m_dhttpMethod)
                                                      {
                                                          return EnvironmentSettings(m_dhttpMethod, agentID);
                                                      }));
#else
            //Sets the windlight settings
            server.AddStreamHandler(new RestHTTPHandler("POST", retVal["EnvironmentSettings"],
                                                        m_dhttpMethod => SetEnvironment(m_dhttpMethod, agentID)));
            //Sets the windlight settings
            server.AddStreamHandler(new RestHTTPHandler("GET", retVal["EnvironmentSettings"],
                                                        m_dhttpMethod => EnvironmentSettings(m_dhttpMethod, agentID)));
#endif
            return retVal;
        }
예제 #21
0
 public HypergridServiceInConnector(IConfigSource config, IHttpServer server, IHyperlinkService hyperService) :
         base(config, server, String.Empty)
 {
     m_HyperlinkService = hyperService;
     server.AddXmlRPCHandler("link_region", LinkRegionRequest, false);
     server.AddXmlRPCHandler("expect_hg_user", ExpectHGUser, false);
 }
예제 #22
0
        // Called from standalone configurations
        public HGFriendsServerConnector(IConfigSource config, IHttpServer server, string configName, IFriendsSimConnector localConn) 
            : base(config, server, configName)
        {
            if (configName != string.Empty)
                m_ConfigName = configName;

            Object[] args = new Object[] { config, m_ConfigName, localConn };

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

            string theService = serverConfig.GetString("LocalServiceModule",
                    String.Empty);
            if (theService == String.Empty)
                throw new Exception("No LocalServiceModule in config file");
            m_TheService = ServerUtils.LoadPlugin<IHGFriendsService>(theService, args);

            theService = serverConfig.GetString("UserAgentService", string.Empty);
            if (theService == String.Empty)
                throw new Exception("No UserAgentService in " + m_ConfigName);
            m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(theService, new Object[] { config, localConn });

            server.AddStreamHandler(new HGFriendsServerPostHandler(m_TheService, m_UserAgentService, localConn));
        }
        public AssetServiceConnector(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 assetService = serverConfig.GetString("LocalServiceModule",
                    String.Empty);

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

            Object[] args = new Object[] { config };
            m_AssetService =
                    ServerUtils.LoadPlugin<IAssetService>(assetService, args);

            bool allowDelete = serverConfig.GetBoolean("AllowRemoteDelete", false);

            server.AddStreamHandler(new AssetServerGetHandler(m_AssetService));
            server.AddStreamHandler(new AssetServerPostHandler(m_AssetService));
            server.AddStreamHandler(new AssetServerDeleteHandler(m_AssetService, allowDelete));
        }
예제 #24
0
파일: RezAvatar.cs 프로젝트: thoys/simian
        public void Start(IScene scene)
        {
            m_scene = scene;

            m_httpServer = m_scene.Simian.GetAppModule<IHttpServer>();
            if (m_httpServer == null)
            {
                m_log.Warn("RezAvatar requires an IHttpServer");
                return;
            }

            m_userClient = m_scene.Simian.GetAppModule<IUserClient>();
            if (m_userClient == null)
            {
                m_log.Warn("RezAvatar requires an IUserClient");
                return;
            }

            m_lludp = scene.GetSceneModule<LLUDP>();
            if (m_lludp == null)
            {
                m_log.Error("Can't create the RegionDomain service without an LLUDP server");
                return;
            }

            string urlFriendlySceneName = WebUtil.UrlEncode(m_scene.Name);
            string regionPath = "/regions/" + urlFriendlySceneName;

            m_httpServer.AddHandler("POST", null, regionPath + "/rez_avatar/request", true, true, RezAvatarRequestHandler);
            m_scene.AddPublicCapability("rez_avatar/request", m_httpServer.HttpAddress.Combine(regionPath + "/rez_avatar/request"));
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="UdpServerEntryPoint"/> class.
 /// </summary>
 /// <param name="logger">The logger.</param>
 /// <param name="networkManager">The network manager.</param>
 /// <param name="serverConfigurationManager">The server configuration manager.</param>
 /// <param name="httpServer">The HTTP server.</param>
 public UdpServerEntryPoint(ILogger logger, INetworkManager networkManager, IServerConfigurationManager serverConfigurationManager, IHttpServer httpServer)
 {
     _logger = logger;
     _networkManager = networkManager;
     _serverConfigurationManager = serverConfigurationManager;
     _httpServer = httpServer;
 }
예제 #26
0
        public GetMeshServerConnector(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 assetService = serverConfig.GetString("AssetService", String.Empty);

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

            Object[] args = new Object[] { config };
            m_AssetService =
                    ServerUtils.LoadPlugin<IAssetService>(assetService, args);

            if (m_AssetService == null)
                throw new Exception(String.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName));

            string rurl = serverConfig.GetString("GetMeshRedirectURL");

            GetMeshHandler gmeshHandler = new GetMeshHandler(m_AssetService);
            IRequestHandler reqHandler
                = new RestHTTPHandler(
                    "GET",
                    "/CAPS/" + UUID.Random(),
                    httpMethod => gmeshHandler.ProcessGetMesh(httpMethod, UUID.Zero, null),
                    "GetMesh",
                    null);
            server.AddStreamHandler(reqHandler); ;
        }
예제 #27
0
        // Constructor for standalone mode
        public HGInventoryService(InventoryServiceBase invService, IAssetService assetService, UserManagerBase userService, IHttpServer httpserver, string thisurl)
        {
            m_userService = userService;
            m_assetProvider = assetService;

            Init(invService, thisurl, httpserver);
        }
예제 #28
0
        public void SetServer(IHttpServer server)
        {
            m_Server = server;

            m_Server.AddHTTPHandler("/StartSession/", HandleHttpStartSession);
            m_Server.AddHTTPHandler("/CloseSession/", HandleHttpCloseSession);
            m_Server.AddHTTPHandler("/SessionCommand/", HandleHttpSessionCommand);
        }
예제 #29
0
		public HttpWebSocketListener(IHttpServer httpServer, IWebSocketServer webSocketServer)
		{
			this.httpServer = httpServer;
			this.webSocketServer = webSocketServer;

			listener = new HttpListener();
			listener.Prefixes.Add("http://*:8080/");
		}
예제 #30
0
        public void Should_start_listening_before_stubs_have_been_set()
        {
            IHttpServer _stubHttp = HttpMockRepository.At(TestContext.CurrentContext.GetCurrentHostUrl());

            _stubHttp.Stub(x => x.Get("/endpoint"))
            .Return("listening")
            .OK();

            using (var tcpClient = new TcpClient())
            {
                var uri = new Uri(TestContext.CurrentContext.GetCurrentHostUrl());

                tcpClient.Connect(uri.Host, uri.Port);

                Assert.That(tcpClient.Connected, Is.True);

                tcpClient.Close();
            }

            string result = new WebClient().DownloadString(string.Format("{0}/endpoint", TestContext.CurrentContext.GetCurrentHostUrl()));

            Assert.That(result, Is.EqualTo("listening"));
        }
예제 #31
0
        public MapGetServiceConnector(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));
            }

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

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

            Object[] args = new Object[] { config };
            m_MapService = ServerUtils.LoadPlugin <IMapImageService>(gridService, args);

            server.AddStreamHandler(new MapServerGetHandler(m_MapService));
        }
예제 #32
0
        public AssetServiceConnector(IConfigSource config, IHttpServer server)
        {
            IConfig serverConfig = config.Configs["AssetService"];

            if (serverConfig == null)
            {
                throw new Exception("No section 'Server' in config file");
            }

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

            if (assetService == String.Empty)
            {
                throw new Exception("No AssetService in config file");
            }

            Object[] args = new Object[] { config };
            m_AssetService = ServerUtils.LoadPlugin <IAssetService>(assetService, args);

            server.AddStreamHandler(new AssetServerGetHandler(m_AssetService));
            server.AddStreamHandler(new AssetServerPostHandler(m_AssetService));
            server.AddStreamHandler(new AssetServerDeleteHandler(m_AssetService));
        }
예제 #33
0
        public void Start(IConfigSource config, IRegistryCore registry)
        {
            IConfig handlerConfig = config.Configs["Handlers"];

            if (handlerConfig.GetString("FriendsInHandler", "") != Name)
            {
                return;
            }

            m_registry = registry;
            m_port     = handlerConfig.GetUInt("FriendsInHandlerPort");

            if (handlerConfig.GetBoolean("UnsecureUrls", false))
            {
                string url = "/friends";

                IHttpServer server = m_registry.RequestModuleInterface <ISimulationBase>().GetHttpServer(m_port);
                m_port = server.Port;

                server.AddStreamHandler(new FriendsServerPostHandler(url, m_registry.RequestModuleInterface <IFriendsService> ().InnerService, 0, m_registry));
            }
            m_registry.RequestModuleInterface <IGridRegistrationService>().RegisterModule(this);
        }
예제 #34
0
        // OnRegisterCaps is invoked via the scene.EventManager
        // everytime OpenSim hands out capabilities to a client
        // (login, region crossing). We contribute two capabilities to
        // the set of capabilities handed back to the client:
        // ProvisionVoiceAccountRequest and ParcelVoiceInfoRequest.
        //
        // ProvisionVoiceAccountRequest allows the client to obtain
        // the voice account credentials for the avatar it is
        // controlling (e.g., user name, password, etc).
        //
        // ParcelVoiceInfoRequest is invoked whenever the client
        // changes from one region or parcel to another.
        //
        // Note that OnRegisterCaps is called here via a closure
        // delegate containing the scene of the respective region (see
        // Initialise()).
        public OSDMap OnRegisterCaps(Scene scene, UUID agentID, IHttpServer caps)
        {
            OSDMap retVal = new OSDMap();

            retVal["ProvisionVoiceAccountRequest"] = CapsUtil.CreateCAPS("ProvisionVoiceAccountRequest", "");
            caps.AddStreamHandler(new RestStreamHandler("POST", retVal["ProvisionVoiceAccountRequest"],
                                                        delegate(string request, string path, string param,
                                                                 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
            {
                return(ProvisionVoiceAccountRequest(scene, request, path, param,
                                                    agentID));
            }));
            retVal["ParcelVoiceInfoRequest"] = CapsUtil.CreateCAPS("ParcelVoiceInfoRequest", "");
            caps.AddStreamHandler(new RestStreamHandler("POST", retVal["ParcelVoiceInfoRequest"],
                                                        delegate(string request, string path, string param,
                                                                 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
            {
                return(ParcelVoiceInfoRequest(scene, request, path, param,
                                              agentID));
            }));

            return(retVal);
        }
예제 #35
0
        public void Should_hit_the_same_url_multiple_times()
        {
            string      endpoint  = TestContext.CurrentContext.GetCurrentHostUrl();
            IHttpServer _stubHttp = HttpMockRepository.At(endpoint);


            _stubHttp
            .Stub(x => x.Get("/api2/echo"))
            .Return("Echo")
            .NotFound();

            _stubHttp
            .Stub(x => x.Get("/api2/echo2"))
            .Return("Nothing")
            .WithStatus(HttpStatusCode.Unauthorized);



            for (int count = 0; count < 6; count++)
            {
                RequestEcho(endpoint);
            }
        }
        public GroupsServiceRobustConnector(IConfigSource config, IHttpServer server, string configName) :
            base(config, server, configName)
        {
            string key = String.Empty;

            if (configName != String.Empty)
            {
                m_ConfigName = configName;
            }

            m_log.DebugFormat("[Groups.RobustConnector]: Starting with config name {0}", m_ConfigName);

            IConfig groupsConfig = config.Configs[m_ConfigName];

            if (groupsConfig != null)
            {
                key = groupsConfig.GetString("SecretKey", string.Empty);
            }

            m_GroupsService = new GroupsService(config);

            server.AddStreamHandler(new GroupsServicePostHandler(m_GroupsService, key));
        }
예제 #37
0
        public XmlRpcServer(IHttpServer httpServer)
        {
            Ensure.IsNotNull(httpServer, nameof(httpServer));

            _httpServer = httpServer;
            Encoding    = Encoding.UTF8;

            Urls = new List <string>();

            _httpServer.RegisterRequestHandler(this);

            Methods = new XmlRpcServerMethods();

            _executor = new XmlRpcMethodExecutor(Methods);

            _dataToXmlRpcValueConverter = new DataToXmlRpcValueConverter();

            _allowedContentTypes = new List <string>
            {
                ContentMediaTypes.Application.Xml,
                ContentMediaTypes.Text.Xml
            };
        }
예제 #38
0
        /// <summary>
        /// Set up the base HTTP server
        /// </summary>
        public virtual void SetUpHTTPServer()
        {
            m_Port =
                (uint)m_config.Configs["Network"].GetInt("http_listener_port", (int)9000);
            uint   httpSSLPort = 9001;
            bool   HttpUsesSSL = false;
            string HttpSSLCN   = "localhost";

            if (m_config.Configs["SSLConfig"] != null)
            {
                httpSSLPort = m_config.Configs["SSLConfig"].GetUInt("http_listener_sslport", (int)9001);
                HttpUsesSSL = m_config.Configs["SSLConfig"].GetBoolean("http_listener_ssl", false);
                HttpSSLCN   = m_config.Configs["SSLConfig"].GetString("http_listener_cn", "localhost");
            }
            m_BaseHTTPServer = GetHttpServer(m_Port, HttpUsesSSL, httpSSLPort, HttpSSLCN);

            if (HttpUsesSSL && (m_Port == httpSSLPort))
            {
                m_log.Error("[HTTPSERVER]: HTTP Server config failed.   HTTP Server and HTTPS server must be on different ports");
            }

            MainServer.Instance = m_BaseHTTPServer;
        }
예제 #39
0
        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.AddStreamHandler(new GenericStreamHandler("GET", "/MapService/", MapRequest));
            m_server.AddStreamHandler(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);
        }
예제 #40
0
        public void Delayed_stub_shouldnt_block_undelayed_stub(int wait, int epsilon)
        {
            _stubHttp = HttpMockRepository.At(_hostUrl);
            _stubHttp.Stub(x => x.Get("/firstEndp")).WithDelay(wait).Return("Delayed response (stub 1)").OK();
            _stubHttp.Stub(x => x.Get("/secondEndp")).Return("Undelayed response (stub 2)").OK();

            Stopwatch     swDelayed     = new Stopwatch();
            Stopwatch     swUndelayed   = new Stopwatch();
            Task <string> taskDelayed   = null,
                          taskUndelayed = null;

            using (var wcUndelayed = new WebClient())
                using (var wcDelayed = new WebClient())
                {
                    // This triggers the server so that we won't have any initial (unwanted) delays

                    wcDelayed.DownloadString($"{_hostUrl}/firstEndp");
                    wcUndelayed.DownloadString($"{_hostUrl}/secondEndp");

                    taskDelayed = StartDelayedRequest(swDelayed);

                    taskUndelayed = Task.Run(() =>
                    {
                        swUndelayed.Start();
                        var ans = wcUndelayed.DownloadString($"{_hostUrl}/secondEndp");
                        swUndelayed.Stop();
                        return(ans);
                    });

                    taskDelayed.Wait();
                    taskUndelayed.Wait();
                }

            Assert.AreEqual("Delayed response (stub 1)", taskDelayed.Result);
            Assert.AreEqual("Undelayed response (stub 2)", taskUndelayed.Result);
            Assert.Greater(swDelayed.ElapsedMilliseconds - epsilon, swUndelayed.ElapsedMilliseconds);
        }
예제 #41
0
        /// <summary>
        /// Initializes the "GlobeViewer" application
        /// </summary>
        /// <param name="panel">Panel used as a container for the "ChromiumWebBrowser" CefSharp control</param>
        public GlobeViewer(Panel panel)
        {
            if (panel == null)
            {
                throw new ArgumentException("'panel' argument can't be null");
            }

            string openglobusApplicationUrl = default(string);

            //Getting a suitable HTTP server running the "OpenglobusApplication"
            if (new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator))
            {
                //If the program is running as Administrator, an HTTP server will be created and will host the "OpenglobusApplication" locally
                httpServer = new HttpServer();
                openglobusApplicationUrl = "http://localhost:" + httpServer.Port.ToString();
            }
            else
            {
                //If the program is not running as Administrator, a remote HTTP server hosting the "OpenglobusApplication" will be used instead
                openglobusApplicationUrl = publicOpenglobusApplicationUrl;
            }

            //Initializing the browser that will present the "OpenglobusApplication"
            browser = new ChromiumWebBrowser(openglobusApplicationUrl)
            {
                Dock = DockStyle.Fill,
            };

            //Initializing the Javascript integration service for communication between .NET and Javascript
            javascriptIntegrationService = new JavascriptIntegrationService(browser);

            //Initializing the geocoder API manager
            geocoder = new GeocoderAPIManager(requestInterval: 1);


            panel.Controls.Add(browser);
        }
        public GetTextureServerConnector(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 assetService = serverConfig.GetString("AssetService", String.Empty);

            if (assetService == String.Empty)
            {
                throw new Exception("No AssetService in config file");
            }

            Object[] args = new Object[] { config };
            m_AssetService =
                ServerUtils.LoadPlugin <IAssetService>(assetService, args);

            if (m_AssetService == null)
            {
                throw new Exception(String.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName));
            }

            string rurl = serverConfig.GetString("GetTextureRedirectURL");

            ;
            server.AddStreamHandler(
                new GetTextureRobustHandler("/CAPS/GetTexture", m_AssetService, "GetTexture", null, rurl));
        }
예제 #43
0
        public void Should_support_range_requests()
        {
            _stubHttp = HttpMockRepository.At(_hostUrl);
            string query      = "/path/file";
            int    fileSize   = 2048;
            string pathToFile = CreateFile(fileSize);

            try
            {
                _stubHttp.Stub(x => x.Get(query))
                .ReturnFileRange(pathToFile, 0, 1023)
                .WithStatus(HttpStatusCode.PartialContent);



                HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(_hostUrl + query);
                request.Method = "GET";
                request.AddRange(0, 1023);
                HttpWebResponse response     = (HttpWebResponse)request.GetResponse();
                byte[]          downloadData = new byte[response.ContentLength];
                using (response)
                {
                    response.GetResponseStream().Read(downloadData, 0, downloadData.Length);
                }
                Assert.That(downloadData.Length, Is.EqualTo(1024));
            }
            finally
            {
                try
                {
                    File.Delete(pathToFile);
                }
                catch
                {
                }
            }
        }
예제 #44
0
        public FetchInventory2ServerConnector(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 invService = serverConfig.GetString("InventoryService", String.Empty);

            if (invService == String.Empty)
            {
                throw new Exception("No InventoryService in config file");
            }

            Object[] args = new Object[] { config };
            m_InventoryService = ServerUtils.LoadPlugin <IInventoryService>(invService, args);

            if (m_InventoryService == null)
            {
                throw new Exception(String.Format("Failed to load InventoryService from {0}; config is {1}", invService, m_ConfigName));
            }

            FetchInventory2Handler fiHandler = new FetchInventory2Handler(m_InventoryService, UUID.Zero);
            IRequestHandler        reqHandler
                = new RestStreamHandler(
                      "POST", "/CAPS/FetchInventory/", fiHandler.FetchInventoryRequest, "FetchInventory", null);

            server.AddStreamHandler(reqHandler);
        }
예제 #45
0
        public AgentPreferencesServiceConnector(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));
            }

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

            if (String.IsNullOrWhiteSpace(service))
            {
                throw new Exception("No LocalServiceModule in config file");
            }

            Object[] args = new Object[] { config };
            m_AgentPreferencesService = ServerUtils.LoadPlugin <IAgentPreferencesService>(service, args);

            IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName);;

            server.AddStreamHandler(new AgentPreferencesServerPostHandler(m_AgentPreferencesService, auth));
        }
        public HGFriendsServerConnector(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 theService = serverConfig.GetString("LocalServiceModule",
                                                       String.Empty);

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

            Object[] args = new Object[] { config };
            m_FriendsService = ServerUtils.LoadPlugin <IFriendsService>(theService, args);

            theService = serverConfig.GetString("UserAgentService", string.Empty);
            if (theService == String.Empty)
            {
                throw new Exception("No UserAgentService in " + m_ConfigName);
            }

            m_UserAgentService = ServerUtils.LoadPlugin <IUserAgentService>(theService, args);

            server.AddStreamHandler(new HGFriendsServerPostHandler(m_FriendsService, m_UserAgentService));
        }
예제 #47
0
        public void Start(IConfigSource config, IRegistryCore registry)
        {
            IConfig handlerConfig = config.Configs["Handlers"];

            if (handlerConfig.GetString("FreeswitchInHandler", "") != Name)
            {
                return;
            }

            m_registry = registry;
            m_port     = handlerConfig.GetUInt("FreeswitchInHandlerPort");

            if (handlerConfig.GetBoolean("UnsecureUrls", false))
            {
                IHttpServer server = registry.RequestModuleInterface <ISimulationBase>().GetHttpServer(m_port);
                m_port = server.Port;

                m_FreeswitchService = registry.RequestModuleInterface <IFreeswitchService>();

                server.AddHTTPHandler(String.Format("{0}/{1}/freeswitch-config", m_freeSwitchAPIPrefix, UUID.Random()), FreeSwitchConfigHTTPHandler);
                server.AddHTTPHandler(String.Format("{0}/{1}/region-config", m_freeSwitchAPIPrefix, UUID.Random()), RegionConfigHTTPHandler);
            }
            m_registry.RequestModuleInterface <IGridRegistrationService>().RegisterModule(this);
        }
예제 #48
0
        public void Should_hit_the_same_url_multiple_times()
        {
            string endpoint = _hostUrl;

            _stubHttp = HttpMockRepository.At(endpoint);


            _stubHttp
            .Stub(x => x.Get("/api2/echo"))
            .Return("Echo")
            .NotFound();

            _stubHttp
            .Stub(x => x.Get("/api2/echo2"))
            .Return("Nothing")
            .WithStatus(HttpStatusCode.Unauthorized);

            Console.WriteLine(_stubHttp.WhatDoIHave());

            for (int count = 0; count < 6; count++)
            {
                RequestEcho(endpoint);
            }
        }
예제 #49
0
        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);
        }
예제 #50
0
        public bool Start(Simian simian)
        {
            m_simian = simian;

            #region Get Module References

            m_httpServer = simian.GetAppModule <IHttpServer>();
            if (m_httpServer == null)
            {
                m_log.Error("Can't create the LindenLogin service without an HTTP server");
                return(false);
            }

            m_userClient = simian.GetAppModule <IUserClient>();
            if (m_userClient == null)
            {
                m_log.Error("Can't create the LindenLogin service without a user client");
                return(false);
            }

            m_gridClient = simian.GetAppModule <IGridClient>();
            if (m_gridClient == null)
            {
                m_log.Error("Can't create the LindenLogin service without a grid client");
                return(false);
            }

            m_inventoryClient = simian.GetAppModule <IInventoryClient>();

            #endregion Get Module References

            m_httpServer.AddXmlRpcHandler("/", true, "login_to_simulator", LoginHandler);
            m_log.Info("LindenLogin handler initialized");

            return(true);
        }
예제 #51
0
        public GetDisplayNamesServerConnector(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 umService = serverConfig.GetString("AssetService", String.Empty);

            if (umService == String.Empty)
            {
                throw new Exception("No AssetService in config file");
            }

            Object[] args = new Object[] { config };
            m_UserManagement =
                ServerUtils.LoadPlugin <IUserManagement>(umService, args);

            if (m_UserManagement == null)
            {
                throw new Exception(String.Format("Failed to load UserManagement from {0}; config is {1}", umService, m_ConfigName));
            }

            string rurl = serverConfig.GetString("GetTextureRedirectURL");

            server.AddStreamHandler(
                new GetDisplayNamesHandler("/CAPS/agents/", m_UserManagement, "GetDisplayNames", null));
        }
        public void RegionLoaded(IScene scene)
        {
            if (!m_Enabled)
            {
                return;
            }
            m_Generator = scene.RequestModuleInterface <IMapImageGenerator>();
            if (m_Generator == null)
            {
                m_Enabled = false;
                return;
            }

            ISimulationBase simulationBase = scene.RequestModuleInterface <ISimulationBase>();

            if (simulationBase != null)
            {
                IHttpServer server = simulationBase.GetHttpServer(0);
                server.AddStreamHandler(new WorldViewRequestHandler(this,
                                                                    scene.RegionInfo.RegionID.ToString()));
                MainConsole.Instance.Info("[WORLDVIEW]: Configured and enabled for " + scene.RegionInfo.RegionName);
                MainConsole.Instance.Info("[WORLDVIEW]: RegionID " + scene.RegionInfo.RegionID);
            }
        }
        // Called from Robust
        public HGGetDisplayNames(IConfigSource config, IHttpServer server, string configName)
        {
            IConfig serverConfig = config.Configs[m_ConfigName];

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

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

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

            Object[] args = new Object[] { config };
            m_UserAccountService = ServerUtils.LoadPlugin <IUserAccountService>(service, args);

            IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName);

            server.AddStreamHandler(new HGGetDisplayNamesPostHandler(m_UserAccountService));
        }
예제 #54
0
        public void SUT_should_return_stubbed_response_for_custom_verbs()
        {
            _stubHttp = HttpMockRepository.At(_hostUrl);

            const string expected = "<xml><>response>Hello World</response></xml>";

            _stubHttp.Stub(x => x.CustomVerb("/endpoint", "PURGE"))
            .Return(expected)
            .OK();



            var request = (HttpWebRequest)WebRequest.Create(string.Format("{0}/endpoint", _hostUrl));

            request.Method = "PURGE";
            request.Host   = "nonstandard.host";
            request.Headers.Add("X-Go-Faster", "11");
            using (var response = request.GetResponse())
                using (var stream = response.GetResponseStream())
                {
                    var responseBody = new StreamReader(stream).ReadToEnd();
                    Assert.That(responseBody, Is.EqualTo(expected));
                }
        }
        public ExperienceServiceConnector(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));
            }

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

            if (service == String.Empty)
            {
                throw new Exception("LocalServiceModule not present in ExperienceService config file ExperienceService section");
            }

            Object[] args = new Object[] { config };
            m_ExperienceService = ServerUtils.LoadPlugin <IExperienceService>(service, args);

            IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName);

            server.AddStreamHandler(new ExperienceServerPostHandler(m_ExperienceService, auth));
        }
        public void RegionLoaded(Scene scene)
        {
            if (m_firstScene == null)
            {
                m_firstScene = scene;

                if (m_enabled)
                {
                    //TODO: fix casting.
                    LibraryRootFolder rootFolder
                        = m_firstScene.CommsManager.UserProfileCacheService.LibraryRoot as LibraryRootFolder;

                    IHttpServer httpServer = m_firstScene.CommsManager.HttpServer;

                    //TODO: fix the casting of the user service, maybe by registering the userManagerBase with scenes, or refactoring so we just need a IUserService reference
                    m_loginService
                        = new LLStandaloneLoginService(
                              (UserManagerBase)m_firstScene.CommsManager.UserAdminService, welcomeMessage,
                              m_firstScene.InventoryService, m_firstScene.CommsManager.NetworkServersInfo, authenticate,
                              rootFolder, this);

                    httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod);

                    // provides the web form login
                    httpServer.AddHTTPHandler("login", m_loginService.ProcessHTMLLogin);

                    // Provides the LLSD login
                    httpServer.SetDefaultLLSDHandler(m_loginService.LLSDLoginMethod);
                }
            }

            if (m_enabled)
            {
                AddScene(scene);
            }
        }
        public void RemoveUrlForClient(string sessionID, string url, uint port)
        {
            IHttpServer server = m_registry.RequestModuleInterface <ISimulationBase>().GetHttpServer(port);

            server.RemoveHTTPHandler("POST", url);
        }
        public void AddExistingUrlForClient(string SessionID, string url, uint port)
        {
            IHttpServer server = m_registry.RequestModuleInterface <ISimulationBase>().GetHttpServer(port);

            server.AddStreamHandler(new MessagingServiceInPostHandler(url, m_registry, this, SessionID));
        }
 public HeloServiceInConnector(IConfigSource config, IHttpServer server, string configName) :
     base(config, server, configName)
 {
     server.AddStreamHandler(new HeloServerGetHandler("opensim-robust"));
     server.AddStreamHandler(new HeloServerHeadHandler("opensim-robust"));
 }