From 5c32b33a66fbdf371d53d85ee54ee8e837481570 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Wed, 4 Jul 2007 16:28:59 +0000 Subject: * re-fixed the utf-16 bug in xmlRpcResponse serialization * added LLSDStreamHandler.cs to Caps (Haven't enabled it yet, though) * removed last traces of old rest handling --- OpenSim/Region/Capabilities/Caps.cs | 38 +++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) (limited to 'OpenSim/Region/Capabilities/Caps.cs') diff --git a/OpenSim/Region/Capabilities/Caps.cs b/OpenSim/Region/Capabilities/Caps.cs index 1d07683..70d601f 100644 --- a/OpenSim/Region/Capabilities/Caps.cs +++ b/OpenSim/Region/Capabilities/Caps.cs @@ -71,20 +71,33 @@ namespace OpenSim.Region.Capabilities public void RegisterHandlers() { Console.WriteLine("registering CAPS handlers"); + string capsBase = "/CAPS/" + m_capsObjectPath; + + AddLegacyCapsHandler( httpListener, m_mapLayerPath, MapLayer); + + //httpListener.AddStreamHandler( + // new LLSDStreamhandler("POST", capsBase + m_mapLayerPath, this.GetMapLayer )); - AddCapsHandler( httpListener, m_requestPath, CapsRequest); - AddCapsHandler( httpListener, m_mapLayerPath, MapLayer); - AddCapsHandler( httpListener, m_newInventory, NewAgentInventory); - AddCapsHandler( httpListener, eventQueue, ProcessEventQueue); - AddCapsHandler( httpListener, m_requestTexture, RequestTexture); + AddLegacyCapsHandler(httpListener, m_requestPath, CapsRequest); + AddLegacyCapsHandler(httpListener, m_newInventory, NewAgentInventory); + AddLegacyCapsHandler( httpListener, eventQueue, ProcessEventQueue); + AddLegacyCapsHandler( httpListener, m_requestTexture, RequestTexture); } - private void AddCapsHandler( BaseHttpServer httpListener, string path, RestMethod restMethod ) + public LLSDMapLayerResponse GetMapLayer(LLSDMapRequest mapReq) + { + LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse(); + mapResponse.LayerData.Array.Add(this.BuildLLSDMapLayerResponse()); + return mapResponse; + } + + [Obsolete("Use BaseHttpServer.AddStreamHandler(new LLSDStreamHandler( LLSDMethod delegate )) instead.")] + private void AddLegacyCapsHandler(BaseHttpServer httpListener, string path, RestMethod restMethod) { string capsBase = "/CAPS/" + m_capsObjectPath; httpListener.AddStreamHandler(new RestStreamHandler("POST", capsBase + path, restMethod)); } - + /// /// /// @@ -125,17 +138,18 @@ namespace OpenSim.Region.Capabilities public string MapLayer(string request, string path, string param) { Encoding _enc = Encoding.UTF8; - Hashtable hash =(Hashtable) LLSD.LLSDDeserialize(_enc.GetBytes(request)); + Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(_enc.GetBytes(request)); LLSDMapRequest mapReq = new LLSDMapRequest(); - LLSDHelpers.DeserialiseLLSDMap(hash, mapReq ); + LLSDHelpers.DeserialiseLLSDMap(hash, mapReq); - LLSDMapLayerResponse mapResponse= new LLSDMapLayerResponse(); + LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse(); mapResponse.LayerData.Array.Add(this.BuildLLSDMapLayerResponse()); string res = LLSDHelpers.SerialiseLLSDReply(mapResponse); - + return res; } + /// /// /// @@ -214,7 +228,7 @@ namespace OpenSim.Region.Capabilities string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); AssetUploader uploader = new AssetUploader(newAsset, newInvItem, uploaderPath, this.httpListener); - AddCapsHandler( httpListener, uploaderPath, uploader.uploaderCaps); + AddLegacyCapsHandler( httpListener, uploaderPath, uploader.uploaderCaps); string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + "/CAPS/" + uploaderPath; //Console.WriteLine("uploader url is " + uploaderURL); -- cgit v1.1