aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorCharles Krinke2009-05-13 01:27:23 +0000
committerCharles Krinke2009-05-13 01:27:23 +0000
commita5feb0682a95065e354406c047fa623c1a811db8 (patch)
tree8ab7600cf5468e41bf3e5d2bf91ebcc716a7ebd3 /OpenSim
parentAdded interface, implementation stub and (diff)
downloadopensim-SC_OLD-a5feb0682a95065e354406c047fa623c1a811db8.zip
opensim-SC_OLD-a5feb0682a95065e354406c047fa623c1a811db8.tar.gz
opensim-SC_OLD-a5feb0682a95065e354406c047fa623c1a811db8.tar.bz2
opensim-SC_OLD-a5feb0682a95065e354406c047fa623c1a811db8.tar.xz
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.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/Servers/BaseOpenSimServer.cs12
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs6
2 files changed, 14 insertions, 4 deletions
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
488 } 488 }
489 489
490 public string StatReport(OSHttpRequest httpRequest) 490 public string StatReport(OSHttpRequest httpRequest)
491 { 491 {
492 return m_stats.XReport((DateTime.Now - m_startuptime).ToString() , m_version ); 492 // If we catch a request for "callback", wrap the response in the value for jsonp
493 if( httpRequest.Query.ContainsKey("callback"))
494 {
495 return httpRequest.Query["callback"].ToString() + "(" + m_stats.XReport((DateTime.Now - m_startuptime).ToString() , m_version ) + ");";
496 }
497 else
498 {
499 return m_stats.XReport((DateTime.Now - m_startuptime).ToString() , m_version );
500 }
493 } 501 }
494 502
495 protected void RemovePIDFile() 503 protected void RemovePIDFile()
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index 21fd5dd..53cba9f 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -861,8 +861,10 @@ namespace OpenSim
861 } 861 }
862 862
863 /// <summary> 863 /// <summary>
864 /// Handler to supply the current extended status of this sim 864 /// Handler to supply the current extended status of this sim to a user configured URI
865 /// Sends the statistical data in a json serialization 865 /// Sends the statistical data in a json serialization
866 /// If the request contains a key, "callback" the response will be wrappend in the
867 /// associated value for jsonp used with ajax/javascript
866 /// </summary> 868 /// </summary>
867 public class UXSimStatusHandler : IStreamedRequestHandler 869 public class UXSimStatusHandler : IStreamedRequestHandler
868 { 870 {
@@ -894,7 +896,7 @@ namespace OpenSim
894 896
895 public string Path 897 public string Path
896 { 898 {
897 // This is for the OpenSim instance and is the osSecret hashed 899 // This is for the OpenSim instance and is the user provided URI
898 get { return "/" + osUXStatsURI + "/"; } 900 get { return "/" + osUXStatsURI + "/"; }
899 } 901 }
900 } 902 }