Add json handler for GridInfo

iar_mods
BlueWall 2012-01-17 21:09:46 -05:00
parent 2e4fbe6b17
commit ef5575be1b
2 changed files with 17 additions and 0 deletions

View File

@ -37,6 +37,7 @@ using Nini.Config;
using Nwc.XmlRpc;
using OpenSim.Framework;
using OpenSim.Framework.Servers.HttpServer;
using OpenMetaverse.StructuredData;
namespace OpenSim.Server.Handlers.Grid
{
@ -142,5 +143,19 @@ namespace OpenSim.Server.Handlers.Grid
return sb.ToString();
}
public string JsonGetGridInfoMethod(string request, string path, string param,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
OSDMap map = new OSDMap();
foreach (string k in _info.Keys)
{
map[k] = OSD.FromString(_info[k].ToString());
}
return OSDParser.SerializeJsonString(map).ToString();
}
}
}

View File

@ -48,6 +48,8 @@ namespace OpenSim.Server.Handlers.Grid
server.AddStreamHandler(new RestStreamHandler("GET", "/get_grid_info",
handlers.RestGetGridInfoMethod));
server.AddStreamHandler(new RestStreamHandler("GET", "/json_grid_info",
handlers.JsonGetGridInfoMethod));
server.AddXmlRPCHandler("get_grid_info", handlers.XmlRpcGridInfoMethod);
}