diff options
author | Melanie | 2012-01-21 19:52:33 +0000 |
---|---|---|
committer | Melanie | 2012-01-21 19:52:33 +0000 |
commit | ba3b0c69f11aaa3b4305cddd57099e98325a146d (patch) | |
tree | cf70355a8cac0579354e67eeb3632a6706d41012 /OpenSim/Server | |
parent | Add some logging (diff) | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-ba3b0c69f11aaa3b4305cddd57099e98325a146d.zip opensim-SC_OLD-ba3b0c69f11aaa3b4305cddd57099e98325a146d.tar.gz opensim-SC_OLD-ba3b0c69f11aaa3b4305cddd57099e98325a146d.tar.bz2 opensim-SC_OLD-ba3b0c69f11aaa3b4305cddd57099e98325a146d.tar.xz |
Merge branch 'master' into careminster
Diffstat (limited to 'OpenSim/Server')
-rw-r--r-- | OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs | 52 | ||||
-rw-r--r-- | OpenSim/Server/Handlers/Grid/GridInfoServerInConnector.cs | 2 |
2 files changed, 53 insertions, 1 deletions
diff --git a/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs b/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs index 645a77f..965a54e 100644 --- a/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs +++ b/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs | |||
@@ -37,13 +37,14 @@ using Nini.Config; | |||
37 | using Nwc.XmlRpc; | 37 | using Nwc.XmlRpc; |
38 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
39 | using OpenSim.Framework.Servers.HttpServer; | 39 | using OpenSim.Framework.Servers.HttpServer; |
40 | using OpenMetaverse.StructuredData; | ||
40 | 41 | ||
41 | namespace OpenSim.Server.Handlers.Grid | 42 | namespace OpenSim.Server.Handlers.Grid |
42 | { | 43 | { |
43 | public class GridInfoHandlers | 44 | public class GridInfoHandlers |
44 | { | 45 | { |
45 | private static readonly ILog _log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 46 | private static readonly ILog _log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
46 | 47 | private IConfigSource m_Config; | |
47 | private Hashtable _info = new Hashtable(); | 48 | private Hashtable _info = new Hashtable(); |
48 | 49 | ||
49 | /// <summary> | 50 | /// <summary> |
@@ -59,6 +60,7 @@ namespace OpenSim.Server.Handlers.Grid | |||
59 | /// </remarks> | 60 | /// </remarks> |
60 | public GridInfoHandlers(IConfigSource configSource) | 61 | public GridInfoHandlers(IConfigSource configSource) |
61 | { | 62 | { |
63 | m_Config = configSource; | ||
62 | loadGridInfo(configSource); | 64 | loadGridInfo(configSource); |
63 | } | 65 | } |
64 | 66 | ||
@@ -142,5 +144,53 @@ namespace OpenSim.Server.Handlers.Grid | |||
142 | 144 | ||
143 | return sb.ToString(); | 145 | return sb.ToString(); |
144 | } | 146 | } |
147 | |||
148 | /// <summary> | ||
149 | /// Get GridInfo in json format: Used bu the OSSL osGetGrid* | ||
150 | /// Adding the SRV_HomeIRI to the kvp returned for use in scripts | ||
151 | /// </summary> | ||
152 | /// <returns> | ||
153 | /// json string | ||
154 | /// </returns> | ||
155 | /// <param name='request'> | ||
156 | /// Request. | ||
157 | /// </param> | ||
158 | /// <param name='path'> | ||
159 | /// /json_grid_info | ||
160 | /// </param> | ||
161 | /// <param name='param'> | ||
162 | /// Parameter. | ||
163 | /// </param> | ||
164 | /// <param name='httpRequest'> | ||
165 | /// Http request. | ||
166 | /// </param> | ||
167 | /// <param name='httpResponse'> | ||
168 | /// Http response. | ||
169 | /// </param> | ||
170 | public string JsonGetGridInfoMethod(string request, string path, string param, | ||
171 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | ||
172 | { | ||
173 | string HomeURI = String.Empty; | ||
174 | IConfig cfg = m_Config.Configs["LoginService"]; | ||
175 | |||
176 | if (null != cfg) | ||
177 | { | ||
178 | HomeURI = cfg.GetString("SRV_HomeURI", HomeURI); | ||
179 | } | ||
180 | |||
181 | OSDMap map = new OSDMap(); | ||
182 | |||
183 | foreach (string k in _info.Keys) | ||
184 | { | ||
185 | map[k] = OSD.FromString(_info[k].ToString()); | ||
186 | } | ||
187 | |||
188 | if (!String.IsNullOrEmpty(HomeURI)) | ||
189 | { | ||
190 | map["home"] = OSD.FromString(HomeURI); | ||
191 | } | ||
192 | |||
193 | return OSDParser.SerializeJsonString(map).ToString(); | ||
194 | } | ||
145 | } | 195 | } |
146 | } | 196 | } |
diff --git a/OpenSim/Server/Handlers/Grid/GridInfoServerInConnector.cs b/OpenSim/Server/Handlers/Grid/GridInfoServerInConnector.cs index 8472d34..f9b5915 100644 --- a/OpenSim/Server/Handlers/Grid/GridInfoServerInConnector.cs +++ b/OpenSim/Server/Handlers/Grid/GridInfoServerInConnector.cs | |||
@@ -48,6 +48,8 @@ namespace OpenSim.Server.Handlers.Grid | |||
48 | 48 | ||
49 | server.AddStreamHandler(new RestStreamHandler("GET", "/get_grid_info", | 49 | server.AddStreamHandler(new RestStreamHandler("GET", "/get_grid_info", |
50 | handlers.RestGetGridInfoMethod)); | 50 | handlers.RestGetGridInfoMethod)); |
51 | server.AddStreamHandler(new RestStreamHandler("GET", "/json_grid_info", | ||
52 | handlers.JsonGetGridInfoMethod)); | ||
51 | server.AddXmlRPCHandler("get_grid_info", handlers.XmlRpcGridInfoMethod); | 53 | server.AddXmlRPCHandler("get_grid_info", handlers.XmlRpcGridInfoMethod); |
52 | } | 54 | } |
53 | 55 | ||