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);
        }
Beispiel #3
0
        public void RegisterCaps(UUID agentID, Caps caps)
        {
            SeedCapsHandler handler = new SeedCapsHandler(m_scene, agentID, caps);
            IRequestHandler reqHandler = new RestStreamHandler("POST", caps.CapsBase + m_requestPath, handler.SeedCapRequest);
            caps.RegisterHandler("SEED", reqHandler); 

            m_log.DebugFormat("[CAPS]: Registered seed capability {0} for {1}", caps.CapsBase + m_requestPath, agentID);
        }
        private void RegisterFetchCap(UUID agentID, Caps caps, string capName, string url)
        {
            string capUrl;

            if (url == "localhost")
            {
                capUrl = "/CAPS/" + UUID.Random();

                IRequestHandler reqHandler
                    = new RestStreamHandler("POST", capUrl, m_fetchHandler.FetchInventoryRequest);

                caps.RegisterHandler(capName, reqHandler);
            }
            else
            {
                capUrl = url;

                caps.RegisterHandler(capName, capUrl);
            }

//            m_log.DebugFormat(
//                "[FETCH INVENTORY2 MODULE]: Registered capability {0} at {1} in region {2} for {3}",
//                capName, capUrl, m_scene.RegionInfo.RegionName, agentID);
        }
Beispiel #5
0
        /// <summary>
        /// Add a REST stream handler to the underlying HTTP server.
        /// </summary>
        /// <param name="httpMethod">GET/PUT/POST/DELETE or
        /// similar</param>
        /// <param name="path">URL prefix</param>
        /// <param name="method">RestMethod handler doing the actual work</param>
        public virtual void AddRestStreamHandler(string httpMethod, string path, RestMethod method)
        {
            if (!IsEnabled) return;

            if (!path.StartsWith(_prefix))
            {
                path = String.Format("{0}{1}", _prefix, path);
            }

            RestStreamHandler h = new RestStreamHandler(httpMethod, path, method);
            _httpd.AddStreamHandler(h);
            _handlers.Add(h);

            m_log.DebugFormat("{0} Added REST handler {1} {2}", MsgID, httpMethod, path);
        }
        public void RegisterCaps(UUID agentID, Caps caps)
        {
            UUID capID = UUID.Random();

            //caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture));
            if (m_URL == "localhost")
            {
                m_log.InfoFormat("[WEBFETCHINVENTORYDESCENDANTS]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName);
                WebFetchInvDescHandler webFetchHandler = new WebFetchInvDescHandler(m_InventoryService, m_LibraryService);
                IRequestHandler reqHandler = new RestStreamHandler("POST", "/CAPS/" + UUID.Random(), webFetchHandler.FetchInventoryDescendentsRequest);
                caps.RegisterHandler("WebFetchInventoryDescendents", reqHandler);
            }
            else
            {
                m_log.InfoFormat("[WEBFETCHINVENTORYDESCENDANTS]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName);
                caps.RegisterHandler("WebFetchInventoryDescendents", m_URL);
            }
        }
Beispiel #7
0
        public void RegisterInventoryServiceHandlers(string capsBase)
        {
            try
            {
                // I don't think this one works...
                m_HostCapsObj.RegisterHandler("NewFileAgentInventory", new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>("POST",
                                                                                           capsBase + m_newInventory,
                                                                                           NewAgentInventoryRequest));
                IRequestHandler req = new RestStreamHandler("POST", capsBase + m_notecardUpdatePath, NoteCardAgentInventory);
                m_HostCapsObj.RegisterHandler("UpdateNotecardAgentInventory", req);
                m_HostCapsObj.RegisterHandler("UpdateScriptAgentInventory", req);
                m_HostCapsObj.RegisterHandler("UpdateScriptAgent", req);
             
                // As of RC 1.22.9 of the Linden client this is
                // supported

                //m_capsHandlers["WebFetchInventoryDescendents"] =new RestStreamHandler("POST", capsBase + m_fetchInventoryPath, FetchInventoryDescendentsRequest);

                // justincc: I've disabled the CAPS service for now to fix problems with selecting textures, and
                // subsequent inventory breakage, in the edit object pane (such as mantis 1085).  This requires
                // enhancements (probably filling out the folder part of the LLSD reply) to our CAPS service,
                // but when I went on the Linden grid, the
                // simulators I visited (version 1.21) were, surprisingly, no longer supplying this capability.  Instead,
                // the 1.19.1.4 client appeared to be happily flowing inventory data over UDP
                //
                // This is very probably just a temporary measure - once the CAPS service appears again on the Linden grid
                // we will be
                // able to get the data we need to implement the necessary part of the protocol to fix the issue above.
                //                m_capsHandlers["FetchInventoryDescendents"] =
                //                    new RestStreamHandler("POST", capsBase + m_fetchInventoryPath, FetchInventoryRequest);

                // m_capsHandlers["FetchInventoryDescendents"] =
                //     new LLSDStreamhandler<LLSDFetchInventoryDescendents, LLSDInventoryDescendents>("POST",
                //                                                                                    capsBase + m_fetchInventory,
                //                                                                                    FetchInventory));
                // m_capsHandlers["RequestTextureDownload"] = new RestStreamHandler("POST",
                //                                                                  capsBase + m_requestTexture,
                //                                                                  RequestTexture);
            }
            catch (Exception e)
            {
                m_log.Error("[CAPS]: " + e.ToString());
            }
        }
        private void OnRegisterCaps(OpenMetaverse.UUID agentID, OpenSim.Framework.Capabilities.Caps caps)
        {
            string capsBase = "/CAPS/" + caps.CapsObjectPath;

            IRequestHandler renderMaterialsPostHandler 
                = new RestStreamHandler("POST", capsBase + "/",
                    (request, path, param, httpRequest, httpResponse)
                        => RenderMaterialsPostCap(request, agentID),
                    "RenderMaterials", null);
            caps.RegisterHandler("RenderMaterials", renderMaterialsPostHandler);

            // OpenSimulator CAPs infrastructure seems to be somewhat hostile towards any CAP that requires both GET
            // and POST handlers, (at least at the time this was originally written), so we first set up a POST
            // handler normally and then add a GET handler via MainServer

            IRequestHandler renderMaterialsGetHandler 
                = new RestStreamHandler("GET", capsBase + "/",
                    (request, path, param, httpRequest, httpResponse)
                        => RenderMaterialsGetCap(request),
                    "RenderMaterials", null);
            MainServer.Instance.AddStreamHandler(renderMaterialsGetHandler);

            // materials viewer seems to use either POST or PUT, so assign POST handler for PUT as well
            IRequestHandler renderMaterialsPutHandler 
                = new RestStreamHandler("PUT", capsBase + "/",
                    (request, path, param, httpRequest, httpResponse)
                        => RenderMaterialsPostCap(request, agentID),
                    "RenderMaterials", null);
            MainServer.Instance.AddStreamHandler(renderMaterialsPutHandler);
        }
Beispiel #9
0
        public void RegisterCaps(UUID agentID, Caps caps)
        {
            UUID capID = UUID.Random();
            bool getTextureCapRegistered = false;

            try
            {
                if (m_useAperture == true)
                {
                    string externalBaseURL = GetApertureBaseURL(caps);
                    string externalURL = GetApertureHttUrl(caps, capID);
                    string addCapURL = externalBaseURL + ADD_CAPS_TOKEN_URL + m_apToken + "/" + capID.ToString();

                    WebRequest req = WebRequest.Create(addCapURL);
                    HttpWebResponse response = (HttpWebResponse)req.GetResponse();

                    if (response.StatusCode != HttpStatusCode.OK)
                    {
                        throw new Exception("Got response '" + response.StatusDescription + "' while trying to register CAPS with HTT");
                    }

                    //register this cap url with the server
                    caps.RegisterHandler("GetTexture", externalURL, 
                        () => this.PauseAperture(caps, capID), 
                        () => this.ResumeAperture(caps, capID),
                        (int bwMax) => this.SetApertureBandwidth(caps, capID, bwMax));
                    getTextureCapRegistered = true;
                }
            }
            catch (Exception e)
            {
                m_log.ErrorFormat(
                    "[APERTURE] Could not contact the aperture texture server to register caps on region {0}. Server returned error {1}", 
                    caps.RegionName, e.Message);
            }

            if (getTextureCapRegistered == false)
            {
#if false
            // If we get here aperture is either disabled or we failed to contact it
            IRequestHandler handler = new GetTextureHandler("/CAPS/" + capID + "/", m_assetService, "GetTexture", agentID.ToString());
            caps.RegisterHandler("GetTexture", handler);
            // m_log.DebugFormat("[GETTEXTURE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName);  
#endif
            }

            IRequestHandler requestHandler;

            ISimulatorFeaturesModule SimulatorFeatures = m_Scene.RequestModuleInterface<ISimulatorFeaturesModule>();
            if ((SimulatorFeatures != null) && (SimulatorFeatures.MeshEnabled == true))
            {
                //use the same cap ID for mesh and HTT. That way the token bucket in aperture will balance the 
                //available bandwidth between mesh and http textures
                //capID = UUID.Random();
                
                bool getMeshCapRegistered = false;

                try
                {
                    if (m_useAperture == true)
                    {
                        string externalBaseURL = GetApertureBaseURL(caps);
                        string externalURL = GetApertureHttUrl(caps, capID);

                        //register this cap url with the server
                        caps.RegisterHandler("GetMesh", externalURL); //caps control for the texture server will apply to pause mesh as well
                        getMeshCapRegistered = true;
                    }
                }
                catch (Exception e)
                {
                    m_log.ErrorFormat(
                        "[APERTURE] Could not contact the aperture texture server to register caps on region {0}. Server returned error {1}",
                        caps.RegionName, e.Message);
                }

                if (getMeshCapRegistered == false)
                {
                    // m_log.DebugFormat("[GETMESH]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName);
                    GetMeshHandler gmeshHandler = new GetMeshHandler(m_Scene, agentID, caps);
                    requestHandler = new RestHTTPHandler(
                            "GET", "/CAPS/" + UUID.Random(),
                            httpMethod => gmeshHandler.ProcessGetMesh(httpMethod, UUID.Zero, null));
                    caps.RegisterHandler("GetMesh", requestHandler);
                }
            }

            // Upload Baked Texture
            UploadBakedTextureHandler uploadHandler = new UploadBakedTextureHandler(m_Scene, caps);
            requestHandler = new RestStreamHandler("POST", "/CAPS/" + caps.CapsObjectPath + m_uploadBakedTexturePath, uploadHandler.UploadBakedTexture);
            caps.RegisterHandler("UploadBakedTexture", requestHandler);

            requestHandler = new RestStreamHandler("POST", caps.CapsBase + "/" + UUID.Random(), GetObjectCostHandler);
            caps.RegisterHandler("GetObjectCost", requestHandler);

            requestHandler = new RestStreamHandler("POST", caps.CapsBase + "/" + UUID.Random(), ResourceCostsSelected);
            caps.RegisterHandler("ResourceCostSelected", requestHandler);

            requestHandler = new RestStreamHandler("POST", caps.CapsBase + "/" + UUID.Random(), GetObjectPhysicsDataHandler);
            caps.RegisterHandler("GetObjectPhysicsData", requestHandler);
        }
            /// <summary>
            /// Register a bunch of CAPS http service handlers
            /// </summary>
            public void RegisterHandlers()
            {
                try
                {
                    IRequestHandler requestHandler;

                    requestHandler = new RestStreamHandler("POST", m_Caps.CapsBase + m_notecardTaskUpdatePath, ScriptTaskInventory);
                    m_Caps.RegisterHandler("UpdateScriptTaskInventory", requestHandler);
                    m_Caps.RegisterHandler("UpdateScriptTask", requestHandler);

                    requestHandler = new RestStreamHandler("POST", m_Caps.CapsBase + m_notecardUpdatePath, NoteCardAgentInventory);
                    m_Caps.RegisterHandler("UpdateNotecardAgentInventory", requestHandler);
                    m_Caps.RegisterHandler("UpdateScriptAgentInventory", requestHandler);
                    m_Caps.RegisterHandler("UpdateScriptAgent", requestHandler);

                    requestHandler = new RestStreamHandler("POST", m_Caps.CapsBase + "/NewFileAgentInventory/", NewAgentInventoryRequest);
                    m_Caps.RegisterHandler("NewFileAgentInventory", requestHandler);
                    //requestHandler = new RestStreamHandler("POST", m_Caps.CapsBase + "/NewFileAgentInventoryVariablePrice/", NewAgentInventoryRequestVariablePrice);
                    //m_Caps.RegisterHandler("NewFileAgentInventoryVariablePrice", requestHandler);

                    requestHandler = new AsyncRequestHandler("POST", m_Caps.CapsBase + m_fetchInventoryPath, AsyncFetchInventoryDescendents);
                    m_Caps.RegisterHandler("FetchInventoryDescendents", requestHandler);
                    m_Caps.RegisterHandler("WebFetchInventoryDescendents", requestHandler); 
                    m_Caps.RegisterHandler("FetchInventoryDescendents2", requestHandler);
                    m_Caps.RegisterHandler("FetchLibDescendents", requestHandler);
                    m_Caps.RegisterHandler("FetchLibDescendents2", requestHandler);

                    requestHandler = new RestStreamHandler("POST", "/CAPS/" + UUID.Random(), FetchInventoryRequest);
                    m_Caps.RegisterHandler("FetchInventory", requestHandler);
                    m_Caps.RegisterHandler("FetchInventory2", requestHandler);

                    requestHandler = new RestStreamHandler("POST", "/CAPS/" + UUID.Random(), FetchLibraryRequest);
                    m_Caps.RegisterHandler("FetchLib", requestHandler);
                    m_Caps.RegisterHandler("FetchLib2", requestHandler);

                    requestHandler = new RestStreamHandler("POST", "/CAPS/" + UUID.Random(), CopyInventoryFromNotecard);
                    m_Caps.RegisterHandler("CopyInventoryFromNotecard", requestHandler);

                    //requestHandler = new RestStreamHandler("POST", m_Caps.CapsBase + UUID.Random(), CreateInventoryCategory);
                    //m_Caps.RegisterHandler("CreateInventoryCategory", requestHandler);
                }
                catch (Exception e)
                {
                    m_log.Error("[CAPS]: " + e.ToString());
                }
            }
        private void OnRegisterCaps(UUID agentID, OpenSim.Framework.Communications.Capabilities.Caps caps)
        {
            string renderCap = CapsUtil.CreateCAPS("RenderMaterials", "");

            // OpenSimulator CAPs infrastructure seems to be somewhat hostile towards any CAP that requires both GET
            // and POST handlers, so we first set up a POST handler normally and then add a GET/PUT handler via MainServer

            IRequestHandler renderMaterialsPostHandler
                = new RestStreamHandler(
                    "POST", renderCap, 
                    (request, path, param, httpRequest, httpResponse) =>  RenderMaterialsPostCap(request, agentID),
                    "RenderMaterials", null);
            MainServer.Instance.AddStreamHandler(renderMaterialsPostHandler);
            caps.RegisterHandler("RenderMaterials", renderMaterialsPostHandler);

            IRequestHandler renderMaterialsGetHandler
                = new RestStreamHandler("GET", renderCap,
                    (request, path, param, httpRequest, httpResponse) => RenderMaterialsGetCap(request),
                    "RenderMaterials", null);
            MainServer.Instance.AddStreamHandler(renderMaterialsGetHandler);

            // materials viewer seems to use either POST or PUT, so assign POST handler for PUT as well
            IRequestHandler renderMaterialsPutHandler
                = new RestStreamHandler("PUT", renderCap,
                    (request, path, param, httpRequest, httpResponse) => RenderMaterialsPostCap(request, agentID),
                    "RenderMaterials", null);
            MainServer.Instance.AddStreamHandler(renderMaterialsPutHandler);
        }
Beispiel #12
0
        public void RegisterRegionServiceHandlers(string capsBase)
        {
            if (m_log.IsDebugEnabled) {
                m_log.DebugFormat ("{0} called", System.Reflection.MethodBase.GetCurrentMethod ().Name);
            }

            try
            {
                // the root of all evil
                m_HostCapsObj.RegisterHandler(
                    "SEED", new RestStreamHandler("POST", capsBase + m_requestPath, SeedCapRequest, "SEED", null));

//                m_log.DebugFormat(
//                    "[CAPS]: Registered seed capability {0} for {1}", capsBase + m_requestPath, m_HostCapsObj.AgentID);

                //m_capsHandlers["MapLayer"] =
                //    new LLSDStreamhandler<OSDMapRequest, OSDMapLayerResponse>("POST",
                //                                                                capsBase + m_mapLayerPath,
                //                                                                GetMapLayer);
                IRequestHandler req
                    = new RestStreamHandler(
                        "POST", capsBase + m_notecardTaskUpdatePath, ScriptTaskInventory, "UpdateScript", null);

                m_HostCapsObj.RegisterHandler("UpdateScriptTaskInventory", req);
                m_HostCapsObj.RegisterHandler("UpdateScriptTask", req);
            }
            catch (Exception e)
            {
                m_log.Error("[CAPS]: " + e.ToString());
            }
        }
Beispiel #13
0
        public void RegisterRegionServiceHandlers(string capsBase)
        {
            try
            {
                // the root of all evil
                m_capsHandlers["SEED"] = new RestStreamHandler("POST", capsBase + m_requestPath, CapsRequest);
                m_log.DebugFormat(
                    "[CAPS]: Registered seed capability {0} for {1}", capsBase + m_requestPath, m_agentID);

                //m_capsHandlers["MapLayer"] =
                //    new LLSDStreamhandler<OSDMapRequest, OSDMapLayerResponse>("POST",
                //                                                                capsBase + m_mapLayerPath,
                //                                                                GetMapLayer);
                m_capsHandlers["UpdateScriptTaskInventory"] =
                    new RestStreamHandler("POST", capsBase + m_notecardTaskUpdatePath, ScriptTaskInventory);
                m_capsHandlers["UpdateScriptTask"] = m_capsHandlers["UpdateScriptTaskInventory"];

            }
            catch (Exception e)
            {
                m_log.Error("[CAPS]: " + e.ToString());
            }
        }
        public void RegisterRegionServiceHandlers(string capsBase)
        {
            try
            {
                // the root of all evil
                m_HostCapsObj.RegisterHandler(
                    "SEED", new RestStreamHandler("POST", capsBase + m_requestPath, SeedCapRequest, "SEED", null));

//                m_log.DebugFormat(
//                    "[CAPS]: Registered seed capability {0} for {1}", capsBase + m_requestPath, m_HostCapsObj.AgentID);

                //m_capsHandlers["MapLayer"] =
                //    new LLSDStreamhandler<OSDMapRequest, OSDMapLayerResponse>("POST",
                //                                                                capsBase + m_mapLayerPath,
                //                                                               GetMapLayer);

                IRequestHandler getObjectPhysicsDataHandler
                    = new RestStreamHandler(
                        "POST", capsBase + m_getObjectPhysicsDataPath, GetObjectPhysicsData, "GetObjectPhysicsData", null);
                m_HostCapsObj.RegisterHandler("GetObjectPhysicsData", getObjectPhysicsDataHandler);

                IRequestHandler getObjectCostHandler = new RestStreamHandler("POST", capsBase + m_getObjectCostPath, GetObjectCost);
                m_HostCapsObj.RegisterHandler("GetObjectCost", getObjectCostHandler);
                IRequestHandler ResourceCostSelectedHandler = new RestStreamHandler("POST", capsBase + m_ResourceCostSelectedPath, ResourceCostSelected);
                m_HostCapsObj.RegisterHandler("ResourceCostSelected", ResourceCostSelectedHandler);
   

                IRequestHandler req
                    = new RestStreamHandler(
                        "POST", capsBase + m_notecardTaskUpdatePath, ScriptTaskInventory, "UpdateScript", null);

                m_HostCapsObj.RegisterHandler("UpdateScriptTaskInventory", req);
                m_HostCapsObj.RegisterHandler("UpdateScriptTask", req);

//                IRequestHandler animSetRequestHandler
//                    = new RestStreamHandler(
//                        "POST", capsBase + m_animSetTaskUpdatePath, AnimSetTaskInventory, "UpdateScript", null);

//                m_HostCapsObj.RegisterHandler("UpdateAnimSetTaskInventory", animSetRequestHandler);
            }
            catch (Exception e)
            {
                m_log.Error("[CAPS]: " + e.ToString());
            }
        }
Beispiel #15
0
        public void RegisterRegionServiceHandlers(string capsBase)
        {
            try
            {
                // the root of all evil
                m_capsHandlers["SEED"] = new RestStreamHandler("POST", capsBase + m_requestPath, CapsRequest);

                m_capsHandlers["UploadBakedTexture"] =
                    new RestStreamHandler("POST", capsBase + m_uploadBakedTexturePath, UploadBakedTexture);

                m_capsHandlers["UpdateScriptTaskInventory"] =
                    new RestStreamHandler("POST", capsBase + m_notecardTaskUpdatePath, ScriptTaskInventory);
                m_capsHandlers["UpdateScriptTask"] = m_capsHandlers["UpdateScriptTaskInventory"];
                m_capsHandlers["UploadBakedTexture"] =
                    new RestStreamHandler("POST", capsBase + m_uploadBakedTexturePath, UploadBakedTexture);

            }
            catch (Exception e)
            {
                m_log.Error("[CAPS]: " + e.ToString());
            }
        }
Beispiel #16
0
        public void RegisterRegionServiceHandlers(string capsBase)
        {
            try
            {
                // the root of all evil
                m_HostCapsObj.RegisterHandler("SEED", new RestStreamHandler("POST", capsBase + m_requestPath, SeedCapRequest));
                m_log.DebugFormat(
                    "[CAPS]: Registered seed capability {0} for {1}", capsBase + m_requestPath, m_HostCapsObj.AgentID);

                //m_capsHandlers["MapLayer"] =
                //    new LLSDStreamhandler<OSDMapRequest, OSDMapLayerResponse>("POST",
                //                                                                capsBase + m_mapLayerPath,
                //                                                                GetMapLayer);
                IRequestHandler req = new RestStreamHandler("POST", capsBase + m_notecardTaskUpdatePath, ScriptTaskInventory);
                m_HostCapsObj.RegisterHandler("UpdateScriptTaskInventory", req);
                m_HostCapsObj.RegisterHandler("UpdateScriptTask", req);
                m_HostCapsObj.RegisterHandler("UploadBakedTexture", new RestStreamHandler("POST", capsBase + m_uploadBakedTexturePath, UploadBakedTexture));

            }
            catch (Exception e)
            {
                m_log.Error("[CAPS]: " + e.ToString());
            }
        }
        /// <summary>
        /// Register the Caps for inventory
        /// </summary>
        /// <param name="agentID"></param>
        /// <param name="caps"></param>
        private OSDMap EventManagerOnRegisterCaps(UUID agentID, IHttpServer server)
        {
            OSDMap retVal = new OSDMap();
            retVal["UpdateScriptTaskInventory"] = CapsUtil.CreateCAPS("UpdateScriptTaskInventory", "");
            retVal["UpdateScriptTask"] = retVal["UpdateScriptTaskInventory"];

            //Region Server bound
            IRequestHandler handler = new RestStreamHandler("POST", retVal["UpdateScriptTask"],
                delegate(string request, string path, string param,
                                          OSHttpRequest httpRequest, OSHttpResponse httpResponse)
                {
                    return ScriptTaskInventory(agentID, request, path, param,
                        httpRequest, httpResponse);
                });
            server.AddStreamHandler(handler);

            retVal["UpdateScriptAgentInventory"] = CapsUtil.CreateCAPS("UpdateScriptAgentInventory", "");
            retVal["UpdateNotecardAgentInventory"] = retVal["UpdateScriptAgentInventory"];
            retVal["UpdateScriptAgent"] = retVal["UpdateNotecardAgentInventory"];
            //Unless the script engine goes, region server bound
            handler = new RestStreamHandler("POST", retVal["UpdateNotecardAgentInventory"], delegate(string request, string path, string param,
                                          OSHttpRequest httpRequest, OSHttpResponse httpResponse)
            {
                return NoteCardAgentInventory(agentID, request, path, param,
                    httpRequest, httpResponse);
            });
            server.AddStreamHandler(handler);
            return retVal;
        }
Beispiel #18
0
        public void OnRegisterCaps(UUID agentID, Caps caps)
        {
            //            m_log.DebugFormat(
            //                "[MOAP]: Registering ObjectMedia and ObjectMediaNavigate capabilities for agent {0}", agentID);

            string omCapUrl = "/CAPS/" + UUID.Random();

            lock (m_omCapUsers)
            {
                m_omCapUsers[omCapUrl] = agentID;
                m_omCapUrls[agentID] = omCapUrl;

                // Even though we're registering for POST we're going to get GETS and UPDATES too
                IRequestHandler handler = new RestStreamHandler("POST", omCapUrl, HandleObjectMediaMessage);
                caps.RegisterHandler("ObjectMedia", handler);

            }

            string omuCapUrl = "/CAPS/" + UUID.Random();

            lock (m_omuCapUsers)
            {
                m_omuCapUsers[omuCapUrl] = agentID;
                m_omuCapUrls[agentID] = omuCapUrl;

                // Even though we're registering for POST we're going to get GETS and UPDATES too
                IRequestHandler handler = new RestStreamHandler("POST", omuCapUrl, HandleObjectMediaNavigateMessage);
                caps.RegisterHandler("ObjectMediaNavigate", handler);
            }
        }
Beispiel #19
0
        public void RegisterCaps(UUID agentID, Caps caps)
        {
            string homeLocationCap = CapsUtil.CreateCAPS("HomeLocation", String.Empty);

            // OpenSimulator CAPs infrastructure seems to be somewhat hostile towards any CAP that requires both GET
            // and POST handlers, so we first set up a POST handler normally and then add a GET/PUT handler via MainServer

            IRequestHandler homeLocationRequestHandler
                = new RestStreamHandler(
                    "POST", homeLocationCap,
                    (request, path, param, httpRequest, httpResponse) => HomeLocation(request, agentID),
                    "HomeLocation", null);

            MainServer.Instance.AddStreamHandler(homeLocationRequestHandler);
            caps.RegisterHandler("HomeLocation", homeLocationRequestHandler);
        }