diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 7ab5c33e26..b35c7910b8 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -488,8 +488,16 @@ namespace OpenSim.Framework.Servers } public string StatReport(OSHttpRequest httpRequest) - { - return m_stats.XReport((DateTime.Now - m_startuptime).ToString() , m_version ); + { + // If we catch a request for "callback", wrap the response in the value for jsonp + if( httpRequest.Query.ContainsKey("callback")) + { + return httpRequest.Query["callback"].ToString() + "(" + m_stats.XReport((DateTime.Now - m_startuptime).ToString() , m_version ) + ");"; + } + else + { + return m_stats.XReport((DateTime.Now - m_startuptime).ToString() , m_version ); + } } protected void RemovePIDFile() diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 21fd5ddd93..53cba9fb15 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -861,8 +861,10 @@ namespace OpenSim } /// - /// Handler to supply the current extended status of this sim + /// Handler to supply the current extended status of this sim to a user configured URI /// Sends the statistical data in a json serialization + /// If the request contains a key, "callback" the response will be wrappend in the + /// associated value for jsonp used with ajax/javascript /// public class UXSimStatusHandler : IStreamedRequestHandler { @@ -894,7 +896,7 @@ namespace OpenSim public string Path { - // This is for the OpenSim instance and is the osSecret hashed + // This is for the OpenSim instance and is the user provided URI get { return "/" + osUXStatsURI + "/"; } } }