Author: chabotc
Date: Fri Jun 20 18:10:56 2008
New Revision: 670111
URL: http://svn.apache.org/viewvc?rev=670111&view=rev
Log:
switched to raw post data, and removed useLegacy from restfulcontainer.js
Modified:
incubator/shindig/trunk/features/opensocial-current/restfulcontainer.js
incubator/shindig/trunk/php/src/socialrest/ActivityHandler.php
incubator/shindig/trunk/php/src/socialrest/AppDataHandler.php
Modified:
incubator/shindig/trunk/features/opensocial-current/restfulcontainer.js
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/features/opensocial-current/restfulcontainer.js?rev=670111&r1=670110&r2=670111&view=diff
==============================================================================
--- incubator/shindig/trunk/features/opensocial-current/restfulcontainer.js
(original)
+++ incubator/shindig/trunk/features/opensocial-current/restfulcontainer.js Fri
Jun 20 18:10:56 2008
@@ -38,11 +38,6 @@
this.baseUrl_ = baseUrl;
this.securityToken_ = shindig.auth.getSecurityToken();
-
- // TODO: Php guys delete this once you handle the new post format! ie there
is no longer an
- // "entry" field. Whatever was in the "entry" field just gets posted
directly.
- this.useLegacy_ = true;
-
this.useBatching_ = false;
};
RestfulContainer.inherits(opensocial.Container);
@@ -93,12 +88,7 @@
};
if (requestObject.request.postData) {
- if (this.useLegacy_) {
- makeRequestParams["POST_DATA"] = gadgets.io.encodeValues(
- {'entry' :
gadgets.json.stringify(requestObject.request.postData)});
- } else {
- makeRequestParams["POST_DATA"] =
gadgets.json.stringify(requestObject.request.postData);
- }
+ makeRequestParams["POST_DATA"] =
gadgets.json.stringify(requestObject.request.postData);
}
var url = requestObject.request.url;
@@ -121,7 +111,7 @@
checkIfFinished();
},
makeRequestParams,
- this.useLegacy_ ? "application/x-www-form-urlencoded" :
"application/json");
+ "application/json");
}
// may need multiple urls for one response but lets ignore that for now
Modified: incubator/shindig/trunk/php/src/socialrest/ActivityHandler.php
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/socialrest/ActivityHandler.php?rev=670111&r1=670110&r2=670111&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/socialrest/ActivityHandler.php (original)
+++ incubator/shindig/trunk/php/src/socialrest/ActivityHandler.php Fri Jun 20
18:10:56 2008
@@ -67,7 +67,10 @@
$userId = UserId::fromJson($params[1]);
$groupId = GroupId::fromJson($params[2]);
// TODO: Should we pass the groupId through to the service?
- $jsonActivity = isset($_POST['entry']) ? $_POST['entry'] :
(isset($_GET['entry']) ? $_GET['entry'] : null);
+ if (!isset($GLOBALS['HTTP_RAW_POST_DATA'])) {
+ throw new Exception("Empty raw post data");
+ }
+ $jsonActivity = $GLOBALS['HTTP_RAW_POST_DATA'];
if (get_magic_quotes_gpc()) {
$jsonActivity = stripslashes($jsonActivity);
}
Modified: incubator/shindig/trunk/php/src/socialrest/AppDataHandler.php
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/socialrest/AppDataHandler.php?rev=670111&r1=670110&r2=670111&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/socialrest/AppDataHandler.php (original)
+++ incubator/shindig/trunk/php/src/socialrest/AppDataHandler.php Fri Jun 20
18:10:56 2008
@@ -82,7 +82,10 @@
$groupId = GroupId::fromJson($params[2]);
$appId = $this->getAppId($params[3], $token);
$fields = isset($_GET['fields']) ? explode(',',
$_GET['fields']) : null;
- $jsonActivity = isset($_POST['entry']) ? $_POST['entry'] :
(isset($_GET['entry']) ? $_GET['entry'] : null);
+ if (!isset($GLOBALS['HTTP_RAW_POST_DATA'])) {
+ throw new Exception("Empty raw post data");
+ }
+ $jsonActivity = $GLOBALS['HTTP_RAW_POST_DATA'];
if (get_magic_quotes_gpc()) {
$jsonActivity = stripslashes($jsonActivity);
}