Add fetching of SRV_HomeURI to "/json_grid_info"

Make SRV_HomeURI available on the GridInfoService through the "/json_grid_info" URI. This i s mainly to service OSSL, but can be seen externally via the URI.
iar_mods
BlueWall 2012-01-19 13:48:31 -05:00
parent eea726d74e
commit bf9ce4709f
1 changed files with 36 additions and 1 deletions

View File

@ -44,7 +44,7 @@ namespace OpenSim.Server.Handlers.Grid
public class GridInfoHandlers public class GridInfoHandlers
{ {
private static readonly ILog _log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog _log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private IConfigSource m_Config;
private Hashtable _info = new Hashtable(); private Hashtable _info = new Hashtable();
/// <summary> /// <summary>
@ -60,6 +60,7 @@ namespace OpenSim.Server.Handlers.Grid
/// </remarks> /// </remarks>
public GridInfoHandlers(IConfigSource configSource) public GridInfoHandlers(IConfigSource configSource)
{ {
m_Config = configSource;
loadGridInfo(configSource); loadGridInfo(configSource);
} }
@ -144,9 +145,38 @@ namespace OpenSim.Server.Handlers.Grid
return sb.ToString(); return sb.ToString();
} }
/// <summary>
/// Get GridInfo in json format: Used bu the OSSL osGetGrid*
/// Adding the SRV_HomeIRI to the kvp returned for use in scripts
/// </summary>
/// <returns>
/// json string
/// </returns>
/// <param name='request'>
/// Request.
/// </param>
/// <param name='path'>
/// /json_grid_info
/// </param>
/// <param name='param'>
/// Parameter.
/// </param>
/// <param name='httpRequest'>
/// Http request.
/// </param>
/// <param name='httpResponse'>
/// Http response.
/// </param>
public string JsonGetGridInfoMethod(string request, string path, string param, public string JsonGetGridInfoMethod(string request, string path, string param,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{ {
string HomeURI = String.Empty;
IConfig cfg = m_Config.Configs["LoginService"];
if (null != cfg)
{
HomeURI = cfg.GetString("SRV_HomeURI", HomeURI);
}
OSDMap map = new OSDMap(); OSDMap map = new OSDMap();
@ -155,6 +185,11 @@ namespace OpenSim.Server.Handlers.Grid
map[k] = OSD.FromString(_info[k].ToString()); map[k] = OSD.FromString(_info[k].ToString());
} }
if (!String.IsNullOrEmpty(HomeURI))
{
map["HomeURI"] = OSD.FromString(HomeURI);
}
return OSDParser.SerializeJsonString(map).ToString(); return OSDParser.SerializeJsonString(map).ToString();
} }
} }