From 9f5f65c8477e3d05f384bafbb1bdf6dcb3f577c8 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Mon, 9 Jul 2007 23:32:29 +0000 Subject: * LLSDStreamhandler now works. --- OpenSim/Region/Capabilities/Caps.cs | 20 ++++++++++---------- OpenSim/Region/Capabilities/LLSDStreamHandler.cs | 14 ++++++++------ 2 files changed, 18 insertions(+), 16 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Capabilities/Caps.cs b/OpenSim/Region/Capabilities/Caps.cs index fdc21cf..6068076 100644 --- a/OpenSim/Region/Capabilities/Caps.cs +++ b/OpenSim/Region/Capabilities/Caps.cs @@ -74,10 +74,10 @@ namespace OpenSim.Region.Capabilities string capsBase = "/CAPS/" + m_capsObjectPath; - AddLegacyCapsHandler( httpListener, m_mapLayerPath, MapLayer); + //AddLegacyCapsHandler( httpListener, m_mapLayerPath, MapLayer); - //httpListener.AddStreamHandler( - // new LLSDStreamhandler("POST", capsBase + m_mapLayerPath, this.GetMapLayer )); + httpListener.AddStreamHandler( + new LLSDStreamhandler("POST", capsBase + m_mapLayerPath, this.GetMapLayer )); AddLegacyCapsHandler(httpListener, m_requestPath, CapsRequest); AddLegacyCapsHandler(httpListener, m_newInventory, NewAgentInventory); @@ -86,13 +86,6 @@ namespace OpenSim.Region.Capabilities } - 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) { @@ -151,6 +144,13 @@ namespace OpenSim.Region.Capabilities return res; } + public LLSDMapLayerResponse GetMapLayer(LLSDMapRequest mapReq) + { + LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse(); + mapResponse.LayerData.Array.Add(this.BuildLLSDMapLayerResponse()); + return mapResponse; + } + /// /// diff --git a/OpenSim/Region/Capabilities/LLSDStreamHandler.cs b/OpenSim/Region/Capabilities/LLSDStreamHandler.cs index ff63353..7d99b6e 100644 --- a/OpenSim/Region/Capabilities/LLSDStreamHandler.cs +++ b/OpenSim/Region/Capabilities/LLSDStreamHandler.cs @@ -14,25 +14,27 @@ namespace OpenSim.Region.Capabilities private LLSDMethod m_method; public LLSDStreamhandler(string httpMethod, string path, LLSDMethod method) - : base(httpMethod, path) + : base(httpMethod, path ) { m_method = method; } public override byte[] Handle(string path, Stream request) { - Encoding encoding = Encoding.UTF8; - StreamReader streamReader = new StreamReader(request, encoding); + //Encoding encoding = Encoding.UTF8; + //StreamReader streamReader = new StreamReader(request, false); - string requestBody = streamReader.ReadToEnd(); - streamReader.Close(); + //string requestBody = streamReader.ReadToEnd(); + //streamReader.Close(); - Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(encoding.GetBytes(requestBody)); + Hashtable hash = (Hashtable)LLSD.LLSDDeserialize( request ); TRequest llsdRequest = new TRequest(); LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest); TResponse response = m_method(llsdRequest); + Encoding encoding = new UTF8Encoding(false); + return encoding.GetBytes( LLSDHelpers.SerialiseLLSDReply(response) ); } -- cgit v1.1