You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wookie.apache.org by sc...@apache.org on 2014/03/07 16:45:47 UTC
svn commit: r1575294 -
/wookie/trunk/wookie-server/src/main/webapp/demo/wookie-connector.js
Author: scottbw
Date: Fri Mar 7 15:45:47 2014
New Revision: 1575294
URL: http://svn.apache.org/r1575294
Log:
Updated the JS connector used in the demo to take account of the changes to the Properties API
Modified:
wookie/trunk/wookie-server/src/main/webapp/demo/wookie-connector.js
Modified: wookie/trunk/wookie-server/src/main/webapp/demo/wookie-connector.js
URL: http://svn.apache.org/viewvc/wookie/trunk/wookie-server/src/main/webapp/demo/wookie-connector.js?rev=1575294&r1=1575293&r2=1575294&view=diff
==============================================================================
--- wookie/trunk/wookie-server/src/main/webapp/demo/wookie-connector.js (original)
+++ wookie/trunk/wookie-server/src/main/webapp/demo/wookie-connector.js Fri Mar 7 15:45:47 2014
@@ -91,12 +91,7 @@ var Wookie = {
var postdata = "api_key=";
postdata = postdata + encodeURI(Wookie.connection.apiKey);
- postdata = postdata + "&is_public=false";
postdata = postdata + "&nonce="+Math.random();
- postdata = postdata + "&propertyname=";
- postdata = postdata + encodeURI(key);
- postdata = postdata + "&propertyvalue=";
- postdata = postdata + encodeURI(value);
postdata = postdata + "&shareddatakey=";
postdata = postdata + encodeURI(Wookie.connection.sharedDataKey);
postdata = postdata + "×tamp="+new Date().toISOString();
@@ -104,13 +99,17 @@ var Wookie = {
postdata = postdata + encodeURI(Wookie.currentUser.loginName);
postdata = postdata + "&widgetid=";
postdata = postdata + encodeURI(id);
+
+ var payload = "{\"preferences\":[{\"name\": \""+key+"\", \"value\":\""+value+"\", \"readOnly\":false}]}";
var uri = "/properties";
var url = Wookie.connection.url +uri;
var signature = Wookie.getSignature("POST", uri, "?" + postdata);
$.ajax({
type: 'POST',
- url: url,
- data: postdata,
+ url: url + "?" + postdata,
+ contentType: 'application/json',
+ processData: false,
+ data: payload,
headers: {
"Authorization":signature
},