aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorlbsa712007-07-09 23:32:29 +0000
committerlbsa712007-07-09 23:32:29 +0000
commit9f5f65c8477e3d05f384bafbb1bdf6dcb3f577c8 (patch)
tree318d92ceda522a31a0acbbc37fdb722835b4e00f /OpenSim
parent* Yeah; forgot; we haven't implemeted 'depends' in prebuild nant target; so b... (diff)
downloadopensim-SC-9f5f65c8477e3d05f384bafbb1bdf6dcb3f577c8.zip
opensim-SC-9f5f65c8477e3d05f384bafbb1bdf6dcb3f577c8.tar.gz
opensim-SC-9f5f65c8477e3d05f384bafbb1bdf6dcb3f577c8.tar.bz2
opensim-SC-9f5f65c8477e3d05f384bafbb1bdf6dcb3f577c8.tar.xz
* LLSDStreamhandler now works.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/Servers/BaseStreamHandler.cs2
-rw-r--r--OpenSim/Framework/Servers/RestStreamHandler.cs2
-rw-r--r--OpenSim/Region/Capabilities/Caps.cs20
-rw-r--r--OpenSim/Region/Capabilities/LLSDStreamHandler.cs14
4 files changed, 20 insertions, 18 deletions
diff --git a/OpenSim/Framework/Servers/BaseStreamHandler.cs b/OpenSim/Framework/Servers/BaseStreamHandler.cs
index 5fcf678..0d9c674 100644
--- a/OpenSim/Framework/Servers/BaseStreamHandler.cs
+++ b/OpenSim/Framework/Servers/BaseStreamHandler.cs
@@ -31,7 +31,7 @@ namespace OpenSim.Framework.Servers
31 31
32 public abstract byte[] Handle(string path, Stream request); 32 public abstract byte[] Handle(string path, Stream request);
33 33
34 protected BaseStreamHandler(string path, string httpMethod ) 34 protected BaseStreamHandler(string httpMethod, string path)
35 { 35 {
36 m_httpMethod = httpMethod; 36 m_httpMethod = httpMethod;
37 m_path = path; 37 m_path = path;
diff --git a/OpenSim/Framework/Servers/RestStreamHandler.cs b/OpenSim/Framework/Servers/RestStreamHandler.cs
index 7ca369d..1b3b41c 100644
--- a/OpenSim/Framework/Servers/RestStreamHandler.cs
+++ b/OpenSim/Framework/Servers/RestStreamHandler.cs
@@ -23,7 +23,7 @@ namespace OpenSim.Framework.Servers
23 return Encoding.UTF8.GetBytes(responseString); 23 return Encoding.UTF8.GetBytes(responseString);
24 } 24 }
25 25
26 public RestStreamHandler(string httpMethod, string path, RestMethod restMethod) : base( path, httpMethod ) 26 public RestStreamHandler(string httpMethod, string path, RestMethod restMethod) : base( httpMethod, path )
27 { 27 {
28 m_restMethod = restMethod; 28 m_restMethod = restMethod;
29 } 29 }
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
74 string capsBase = "/CAPS/" + m_capsObjectPath; 74 string capsBase = "/CAPS/" + m_capsObjectPath;
75 75
76 76
77 AddLegacyCapsHandler( httpListener, m_mapLayerPath, MapLayer); 77 //AddLegacyCapsHandler( httpListener, m_mapLayerPath, MapLayer);
78 78
79 //httpListener.AddStreamHandler( 79 httpListener.AddStreamHandler(
80 // new LLSDStreamhandler<LLSDMapRequest, LLSDMapLayerResponse>("POST", capsBase + m_mapLayerPath, this.GetMapLayer )); 80 new LLSDStreamhandler<LLSDMapRequest, LLSDMapLayerResponse>("POST", capsBase + m_mapLayerPath, this.GetMapLayer ));
81 81
82 AddLegacyCapsHandler(httpListener, m_requestPath, CapsRequest); 82 AddLegacyCapsHandler(httpListener, m_requestPath, CapsRequest);
83 AddLegacyCapsHandler(httpListener, m_newInventory, NewAgentInventory); 83 AddLegacyCapsHandler(httpListener, m_newInventory, NewAgentInventory);
@@ -86,13 +86,6 @@ namespace OpenSim.Region.Capabilities
86 86
87 } 87 }
88 88
89 public LLSDMapLayerResponse GetMapLayer(LLSDMapRequest mapReq)
90 {
91 LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse();
92 mapResponse.LayerData.Array.Add(this.BuildLLSDMapLayerResponse());
93 return mapResponse;
94 }
95
96 [Obsolete("Use BaseHttpServer.AddStreamHandler(new LLSDStreamHandler( LLSDMethod delegate )) instead.")] 89 [Obsolete("Use BaseHttpServer.AddStreamHandler(new LLSDStreamHandler( LLSDMethod delegate )) instead.")]
97 private void AddLegacyCapsHandler(BaseHttpServer httpListener, string path, RestMethod restMethod) 90 private void AddLegacyCapsHandler(BaseHttpServer httpListener, string path, RestMethod restMethod)
98 { 91 {
@@ -151,6 +144,13 @@ namespace OpenSim.Region.Capabilities
151 return res; 144 return res;
152 } 145 }
153 146
147 public LLSDMapLayerResponse GetMapLayer(LLSDMapRequest mapReq)
148 {
149 LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse();
150 mapResponse.LayerData.Array.Add(this.BuildLLSDMapLayerResponse());
151 return mapResponse;
152 }
153
154 154
155 /// <summary> 155 /// <summary>
156 /// 156 ///
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
14 private LLSDMethod<TRequest, TResponse> m_method; 14 private LLSDMethod<TRequest, TResponse> m_method;
15 15
16 public LLSDStreamhandler(string httpMethod, string path, LLSDMethod<TRequest, TResponse> method) 16 public LLSDStreamhandler(string httpMethod, string path, LLSDMethod<TRequest, TResponse> method)
17 : base(httpMethod, path) 17 : base(httpMethod, path )
18 { 18 {
19 m_method = method; 19 m_method = method;
20 } 20 }
21 21
22 public override byte[] Handle(string path, Stream request) 22 public override byte[] Handle(string path, Stream request)
23 { 23 {
24 Encoding encoding = Encoding.UTF8; 24 //Encoding encoding = Encoding.UTF8;
25 StreamReader streamReader = new StreamReader(request, encoding); 25 //StreamReader streamReader = new StreamReader(request, false);
26 26
27 string requestBody = streamReader.ReadToEnd(); 27 //string requestBody = streamReader.ReadToEnd();
28 streamReader.Close(); 28 //streamReader.Close();
29 29
30 Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(encoding.GetBytes(requestBody)); 30 Hashtable hash = (Hashtable)LLSD.LLSDDeserialize( request );
31 TRequest llsdRequest = new TRequest(); 31 TRequest llsdRequest = new TRequest();
32 LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest); 32 LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest);
33 33
34 TResponse response = m_method(llsdRequest); 34 TResponse response = m_method(llsdRequest);
35 35
36 Encoding encoding = new UTF8Encoding(false);
37
36 return encoding.GetBytes( LLSDHelpers.SerialiseLLSDReply(response) ); 38 return encoding.GetBytes( LLSDHelpers.SerialiseLLSDReply(response) );
37 39
38 } 40 }