From a5feb0682a95065e354406c047fa623c1a811db8 Mon Sep 17 00:00:00 2001 From: Charles Krinke Date: Wed, 13 May 2009 01:27:23 +0000 Subject: Thank you kindly, BlueWall sir, for a patch that: Adding a jsonp wrapper to the user supplied status report uri if the key "callback" exists. It will work with many javascript toolkits to provide an ajax callback to allow the browser to update stats reports without the intervention of an intermediate server. --- OpenSim/Framework/Servers/BaseOpenSimServer.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 7ab5c33..b35c791 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() -- cgit v1.1