aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs')
-rw-r--r--OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs45
1 files changed, 29 insertions, 16 deletions
diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
index c63b409..849fa94 100644
--- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
@@ -40,6 +40,7 @@ using OpenSim.Server.Base;
40using OpenSim.Services.Interfaces; 40using OpenSim.Services.Interfaces;
41using GridRegion = OpenSim.Services.Interfaces.GridRegion; 41using GridRegion = OpenSim.Services.Interfaces.GridRegion;
42using OpenSim.Framework; 42using OpenSim.Framework;
43using OpenSim.Framework.ServiceAuth;
43using OpenSim.Framework.Servers.HttpServer; 44using OpenSim.Framework.Servers.HttpServer;
44using OpenMetaverse; 45using OpenMetaverse;
45 46
@@ -49,10 +50,14 @@ namespace OpenSim.Server.Handlers.Grid
49 { 50 {
50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
51 52
53#pragma warning disable 414
54 private static string LogHeader = "[GRID HANDLER]";
55#pragma warning restore 414
56
52 private IGridService m_GridService; 57 private IGridService m_GridService;
53 58
54 public GridServerPostHandler(IGridService service) : 59 public GridServerPostHandler(IGridService service, IServiceAuth auth) :
55 base("POST", "/grid") 60 base("POST", "/grid", auth)
56 { 61 {
57 m_GridService = service; 62 m_GridService = service;
58 } 63 }
@@ -117,6 +122,9 @@ namespace OpenSim.Server.Handlers.Grid
117 122
118 case "get_region_flags": 123 case "get_region_flags":
119 return GetRegionFlags(request); 124 return GetRegionFlags(request);
125
126 case "get_grid_extra_features":
127 return GetGridExtraFeatures(request);
120 } 128 }
121 129
122 m_log.DebugFormat("[GRID HANDLER]: unknown method request {0}", method); 130 m_log.DebugFormat("[GRID HANDLER]: unknown method request {0}", method);
@@ -281,8 +289,8 @@ namespace OpenSim.Server.Handlers.Grid
281 else 289 else
282 m_log.WarnFormat("[GRID HANDLER]: no Y in request to get region by position"); 290 m_log.WarnFormat("[GRID HANDLER]: no Y in request to get region by position");
283 291
292 // m_log.DebugFormat("{0} GetRegionByPosition: loc=<{1},{2}>", LogHeader, x, y);
284 GridRegion rinfo = m_GridService.GetRegionByPosition(scopeID, x, y); 293 GridRegion rinfo = m_GridService.GetRegionByPosition(scopeID, x, y);
285 //m_log.DebugFormat("[GRID HANDLER]: neighbours for region {0}: {1}", regionID, rinfos.Count);
286 294
287 Dictionary<string, object> result = new Dictionary<string, object>(); 295 Dictionary<string, object> result = new Dictionary<string, object>();
288 if (rinfo == null) 296 if (rinfo == null)
@@ -573,6 +581,22 @@ namespace OpenSim.Server.Handlers.Grid
573 //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); 581 //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
574 return Util.UTF8NoBomEncoding.GetBytes(xmlString); 582 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
575 } 583 }
584
585 byte[] GetGridExtraFeatures(Dictionary<string, object> request)
586 {
587
588 Dictionary<string, object> result = new Dictionary<string, object> ();
589 Dictionary<string, object> extraFeatures = m_GridService.GetExtraFeatures ();
590
591 foreach (string key in extraFeatures.Keys)
592 {
593 result [key] = extraFeatures [key];
594 }
595
596 string xmlString = ServerUtils.BuildXmlResponse(result);
597
598 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
599 }
576 600
577 #endregion 601 #endregion
578 602
@@ -597,7 +621,7 @@ namespace OpenSim.Server.Handlers.Grid
597 621
598 rootElement.AppendChild(result); 622 rootElement.AppendChild(result);
599 623
600 return DocToBytes(doc); 624 return Util.DocToBytes(doc);
601 } 625 }
602 626
603 private byte[] FailureResult() 627 private byte[] FailureResult()
@@ -629,18 +653,7 @@ namespace OpenSim.Server.Handlers.Grid
629 653
630 rootElement.AppendChild(message); 654 rootElement.AppendChild(message);
631 655
632 return DocToBytes(doc); 656 return Util.DocToBytes(doc);
633 }
634
635 private byte[] DocToBytes(XmlDocument doc)
636 {
637 MemoryStream ms = new MemoryStream();
638 XmlTextWriter xw = new XmlTextWriter(ms, null);
639 xw.Formatting = Formatting.Indented;
640 doc.WriteTo(xw);
641 xw.Flush();
642
643 return ms.ToArray();
644 } 657 }
645 658
646 #endregion 659 #endregion