diff options
Diffstat (limited to 'Common/OpenSim.Servers')
-rw-r--r-- | Common/OpenSim.Servers/BaseHttpServer.cs | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/Common/OpenSim.Servers/BaseHttpServer.cs b/Common/OpenSim.Servers/BaseHttpServer.cs index 3daec8d..71c36a7 100644 --- a/Common/OpenSim.Servers/BaseHttpServer.cs +++ b/Common/OpenSim.Servers/BaseHttpServer.cs | |||
@@ -66,6 +66,7 @@ namespace OpenSim.Servers | |||
66 | protected Dictionary<string, RestMethodEntry> m_restHandlers = new Dictionary<string, RestMethodEntry>(); | 66 | protected Dictionary<string, RestMethodEntry> m_restHandlers = new Dictionary<string, RestMethodEntry>(); |
67 | protected Dictionary<string, XmlRpcMethod> m_rpcHandlers = new Dictionary<string, XmlRpcMethod>(); | 67 | protected Dictionary<string, XmlRpcMethod> m_rpcHandlers = new Dictionary<string, XmlRpcMethod>(); |
68 | protected int m_port; | 68 | protected int m_port; |
69 | protected bool firstcaps = true; | ||
69 | 70 | ||
70 | public BaseHttpServer(int port) | 71 | public BaseHttpServer(int port) |
71 | { | 72 | { |
@@ -74,6 +75,7 @@ namespace OpenSim.Servers | |||
74 | 75 | ||
75 | public bool AddRestHandler(string method, string path, RestMethod handler) | 76 | public bool AddRestHandler(string method, string path, RestMethod handler) |
76 | { | 77 | { |
78 | Console.WriteLine("adding new REST handler for path " + path); | ||
77 | string methodKey = String.Format("{0}: {1}", method, path); | 79 | string methodKey = String.Format("{0}: {1}", method, path); |
78 | 80 | ||
79 | if (!this.m_restHandlers.ContainsKey(methodKey)) | 81 | if (!this.m_restHandlers.ContainsKey(methodKey)) |
@@ -158,7 +160,14 @@ namespace OpenSim.Servers | |||
158 | protected virtual string ParseLLSDXML(string requestBody) | 160 | protected virtual string ParseLLSDXML(string requestBody) |
159 | { | 161 | { |
160 | // dummy function for now - IMPLEMENT ME! | 162 | // dummy function for now - IMPLEMENT ME! |
161 | return ""; | 163 | Console.WriteLine("LLSD request "+requestBody); |
164 | string resp = ""; | ||
165 | if (firstcaps) | ||
166 | { | ||
167 | resp = "<llsd><map><key>MapLayer</key><string>http://127.0.0.1:9000/CAPS/</string></map></llsd>"; | ||
168 | firstcaps = false; | ||
169 | } | ||
170 | return resp; | ||
162 | } | 171 | } |
163 | 172 | ||
164 | protected virtual string ParseXMLRPC(string requestBody) | 173 | protected virtual string ParseXMLRPC(string requestBody) |
@@ -204,6 +213,7 @@ namespace OpenSim.Servers | |||
204 | //Console.WriteLine(requestBody); | 213 | //Console.WriteLine(requestBody); |
205 | 214 | ||
206 | string responseString = ""; | 215 | string responseString = ""; |
216 | Console.WriteLine("new request " + request.ContentType); | ||
207 | switch (request.ContentType) | 217 | switch (request.ContentType) |
208 | { | 218 | { |
209 | case "text/xml": | 219 | case "text/xml": |
@@ -217,7 +227,9 @@ namespace OpenSim.Servers | |||
217 | 227 | ||
218 | case "application/xml": | 228 | case "application/xml": |
219 | // probably LLSD we hope, otherwise it should be ignored by the parser | 229 | // probably LLSD we hope, otherwise it should be ignored by the parser |
220 | responseString = ParseLLSDXML(requestBody); | 230 | // responseString = ParseLLSDXML(requestBody); |
231 | Console.WriteLine(" request " + request.HttpMethod + " to " + request.RawUrl); | ||
232 | responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod); | ||
221 | response.AddHeader("Content-type", "application/xml"); | 233 | response.AddHeader("Content-type", "application/xml"); |
222 | break; | 234 | break; |
223 | 235 | ||