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.DebugFormat("[GETMESH]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); GetMeshHandler gmeshHandler = new GetMeshHandler(m_AssetService); IRequestHandler reqHandler = new RestHTTPHandler( "GET", "/CAPS/" + UUID.Random(), httpMethod => gmeshHandler.ProcessGetMesh(httpMethod, UUID.Zero, null), "GetMesh", agentID.ToString()); caps.RegisterHandler("GetMesh", reqHandler); } else { // m_log.DebugFormat("[GETMESH]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName); caps.RegisterHandler("GetMesh", m_URL); } }
public void RegisterCaps(UUID agentID, Caps caps) { UUID capID = UUID.Random(); 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)); } } 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); } 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); }
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); }