aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Examples/SimpleApp/LlsdMethodEntry.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Examples/SimpleApp/LlsdMethodEntry.cs')
-rw-r--r--OpenSim/Region/Examples/SimpleApp/LlsdMethodEntry.cs44
1 files changed, 44 insertions, 0 deletions
diff --git a/OpenSim/Region/Examples/SimpleApp/LlsdMethodEntry.cs b/OpenSim/Region/Examples/SimpleApp/LlsdMethodEntry.cs
new file mode 100644
index 0000000..c3d3d33
--- /dev/null
+++ b/OpenSim/Region/Examples/SimpleApp/LlsdMethodEntry.cs
@@ -0,0 +1,44 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenSim.Framework.Servers;
5using OpenSim.Region.Capabilities;
6using libsecondlife;
7using System.Collections;
8
9namespace OpenSim.Framework.Servers
10{
11 public class LlsdMethodEntry<TResponse, TRequest> : ILlsdMethodHandler
12 where TRequest : new()
13 {
14 private LlsdMethod<TResponse, TRequest> m_method;
15
16
17 public LlsdMethodEntry( )
18 {
19
20 }
21
22 public LlsdMethodEntry(LlsdMethod<TResponse, TRequest> method)
23 {
24 m_method = method;
25 }
26
27 #region ILlsdMethodHandler Members
28
29 public string Handle(string body, string path)
30 {
31 Encoding _enc = System.Text.Encoding.UTF8;
32 Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(_enc.GetBytes( body ));
33 TRequest request = new TRequest();
34
35 LLSDHelpers.DeserialiseLLSDMap(hash, request );
36
37 TResponse response = m_method(request);
38
39 return LLSDHelpers.SerialiseLLSDReply( response );
40 }
41
42 #endregion
43 }
44}