Author: lindner
Date: Thu Jun 18 21:16:57 2009
New Revision: 786290
URL: http://svn.apache.org/viewvc?rev=786290&view=rev
Log:
SHINDIG-1055 | add javascript support for opensocial.invalidateCache()
Modified:
incubator/shindig/trunk/config/container.js
incubator/shindig/trunk/features/src/main/javascript/features/opensocial-jsonrpc/jsonrpccontainer.js
incubator/shindig/trunk/features/src/main/javascript/features/opensocial-reference/container.js
incubator/shindig/trunk/features/src/main/javascript/features/opensocial-reference/opensocial.js
Modified: incubator/shindig/trunk/config/container.js
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/config/container.js?rev=786290&r1=786289&r2=786290&view=diff
==============================================================================
--- incubator/shindig/trunk/config/container.js (original)
+++ incubator/shindig/trunk/config/container.js Thu Jun 18 21:16:57 2009
@@ -20,16 +20,16 @@
// Default container configuration. To change the configuration, you have two
options:
//
// A. If you run the Java server: Create your own "myContainer.js" file and
-// modify the value in web.xml.
+// modify the value in web.xml.
//
// B. If you run the PHP server: Create a myContainer.js, copy the contents
of container.js to it,
-// change
+// change
// {"gadgets.container" : ["default"],
// to
// {"gadgets.container" : ["myContainer"],
// And make your changes that you need to myContainer.js.
-// Just make sure on the iframe URL you specify &container=myContainer
-// for it to use that config.
+// Just make sure on the iframe URL you specify &container=myContainer
+// for it to use that config.
//
// All configurations will automatically inherit values from this
// config, so you only need to provide configuration for items
@@ -83,7 +83,7 @@
"gadgets.osDataUri" : "http://%host%/social/rpc",
// Uncomment these to switch to a secure version
-//
+//
//"gadgets.securityTokenType" : "secure",
//"gadgets.securityTokenKeyFile" : "/path/to/key/file.txt",
@@ -136,7 +136,7 @@
"opensocial-0.8" : {
// Path to fetch opensocial data from
// Must be on the same domain as the gadget rendering server
- "path" : "http://%host%/social",
+ "path" : "http://%host%",
"domain" : "shindig",
"enableCaja" : false,
"supportedFields" : {
Modified:
incubator/shindig/trunk/features/src/main/javascript/features/opensocial-jsonrpc/jsonrpccontainer.js
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/features/src/main/javascript/features/opensocial-jsonrpc/jsonrpccontainer.js?rev=786290&r1=786289&r2=786290&view=diff
==============================================================================
---
incubator/shindig/trunk/features/src/main/javascript/features/opensocial-jsonrpc/jsonrpccontainer.js
(original)
+++
incubator/shindig/trunk/features/src/main/javascript/features/opensocial-jsonrpc/jsonrpccontainer.js
Thu Jun 18 21:16:57 2009
@@ -206,7 +206,7 @@
"POST_DATA" : gadgets.json.stringify(jsonBatchData)
};
- var url = [this.baseUrl_, "/rpc"];
+ var url = [this.baseUrl_, "/social/rpc"];
var token = shindig.auth.getSecurityToken();
if (token) {
url.push("?st=", encodeURIComponent(token));
@@ -426,6 +426,29 @@
return new JsonRpcRequestItem(rpc);
};
+
+ JsonRpcContainer.prototype.invalidateCache = function() {
+ var rpc = { method : "cache.invalidate" };
+ var invalidationKeys = { invalidationKeys : ["@viewer"] };
+ rpc.params = invalidationKeys;
+
+ var makeRequestParams = {
+ "CONTENT_TYPE" : "JSON",
+ "METHOD" : "POST",
+ "AUTHORIZATION" : "SIGNED",
+ "POST_DATA" : gadgets.json.stringify(rpc)
+ };
+
+ var url = [this.baseUrl_, "/gadgets/api/rpc"];
+ var token = shindig.auth.getSecurityToken();
+ if (token) {
+ url.push("?st=", encodeURIComponent(token));
+ }
+
+ this.sendRequest(url.join(''), null, makeRequestParams,
+ "application/json");
+ };
+
})();
JsonRpcContainer.prototype.newMessage = function(body, opt_params) {
Modified:
incubator/shindig/trunk/features/src/main/javascript/features/opensocial-reference/container.js
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/features/src/main/javascript/features/opensocial-reference/container.js?rev=786290&r1=786289&r2=786290&view=diff
==============================================================================
---
incubator/shindig/trunk/features/src/main/javascript/features/opensocial-reference/container.js
(original)
+++
incubator/shindig/trunk/features/src/main/javascript/features/opensocial-reference/container.js
Thu Jun 18 21:16:57 2009
@@ -467,6 +467,11 @@
return new opensocial.Environment(domain, supportedFields);
};
+/**
+ * Invalidates all resources cached for the current viewer.
+ */
+opensocial.Container.prototype.invalidateCache = function() {
+};
/**
* Returns true if the specified value is an array
@@ -523,7 +528,7 @@
return encodeURI(decodeURI(uri));
}
// This callback can be replaced with one that passes the URL through
- // a proxy that checks the mimetype.
+ // a proxy that checks the mimetype.
return null;
}
};
Modified:
incubator/shindig/trunk/features/src/main/javascript/features/opensocial-reference/opensocial.js
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/features/src/main/javascript/features/opensocial-reference/opensocial.js?rev=786290&r1=786289&r2=786290&view=diff
==============================================================================
---
incubator/shindig/trunk/features/src/main/javascript/features/opensocial-reference/opensocial.js
(original)
+++
incubator/shindig/trunk/features/src/main/javascript/features/opensocial-reference/opensocial.js
Thu Jun 18 21:16:57 2009
@@ -448,6 +448,14 @@
};
+/**
+ * Invalidates all resources cached for the current viewer.
+ */
+opensocial.invalidateCache = function() {
+ opensocial.Container.get().invalidateCache();
+};
+
+
// TODO(doll): Util function - pull up the gadgets inherits in shindig so that
// opensocial and gadgets use the same one
/** @private */