aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Capabilities/LLSDStreamHandler.cs
diff options
context:
space:
mode:
authorlbsa712007-07-04 16:28:59 +0000
committerlbsa712007-07-04 16:28:59 +0000
commit5c32b33a66fbdf371d53d85ee54ee8e837481570 (patch)
tree68121d2b62aa34e2f8e627823314460a19fe06f8 /OpenSim/Region/Capabilities/LLSDStreamHandler.cs
parent* Removed AssetHttpServer, using BaseHttpServer instead (diff)
downloadopensim-SC-5c32b33a66fbdf371d53d85ee54ee8e837481570.zip
opensim-SC-5c32b33a66fbdf371d53d85ee54ee8e837481570.tar.gz
opensim-SC-5c32b33a66fbdf371d53d85ee54ee8e837481570.tar.bz2
opensim-SC-5c32b33a66fbdf371d53d85ee54ee8e837481570.tar.xz
* 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
Diffstat (limited to 'OpenSim/Region/Capabilities/LLSDStreamHandler.cs')
-rw-r--r--OpenSim/Region/Capabilities/LLSDStreamHandler.cs40
1 files changed, 40 insertions, 0 deletions
diff --git a/OpenSim/Region/Capabilities/LLSDStreamHandler.cs b/OpenSim/Region/Capabilities/LLSDStreamHandler.cs
new file mode 100644
index 0000000..ff63353
--- /dev/null
+++ b/OpenSim/Region/Capabilities/LLSDStreamHandler.cs
@@ -0,0 +1,40 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenSim.Framework.Servers;
5using System.IO;
6using System.Collections;
7using libsecondlife;
8
9namespace OpenSim.Region.Capabilities
10{
11 public class LLSDStreamhandler<TRequest, TResponse> : BaseStreamHandler
12 where TRequest : new()
13 {
14 private LLSDMethod<TRequest, TResponse> m_method;
15
16 public LLSDStreamhandler(string httpMethod, string path, LLSDMethod<TRequest, TResponse> method)
17 : base(httpMethod, path)
18 {
19 m_method = method;
20 }
21
22 public override byte[] Handle(string path, Stream request)
23 {
24 Encoding encoding = Encoding.UTF8;
25 StreamReader streamReader = new StreamReader(request, encoding);
26
27 string requestBody = streamReader.ReadToEnd();
28 streamReader.Close();
29
30 Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(encoding.GetBytes(requestBody));
31 TRequest llsdRequest = new TRequest();
32 LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest);
33
34 TResponse response = m_method(llsdRequest);
35
36 return encoding.GetBytes( LLSDHelpers.SerialiseLLSDReply(response) );
37
38 }
39 }
40}