From commitscastroshelia@example.net Tue Nov 02 09:37:59 2010 Return-Path: <commitscastroshelia@example.net> Delivered-To: castroshelia@example.net Received: (qmail 89955 invoked from network); 2 Nov 2010 09:37:59 -0000 Received: from unknown (HELO mail.apache.org) (83.161.120.155) by 83.161.120.155 with SMTP; 2 Nov 2010 09:37:59 -0000 Received: (qmail 65798 invoked by uid 500); 2 Nov 2010 09:38:30 -0000 Delivered-To: castroshelia@example.net Received: (qmail 65680 invoked by uid 500); 2 Nov 2010 09:38:28 -0000 Mailing-List: contact castroshelia@example.net; run by ezmlm Precedence: bulk List-Help: <mailto:castroshelia@example.net> List-Unsubscribe: <mailto:castroshelia@example.net> List-Post: <mailto:castroshelia@example.net> List-Id: <commits.shindig.apache.org> Reply-To: castroshelia@example.net Delivered-To: mailing list castroshelia@example.net Received: (qmail 65673 invoked by uid 99); 2 Nov 2010 09:38:27 -0000 Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Nov 2010 09:38:27 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Nov 2010 09:38:27 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id DD66923889E3; Tue, 2 Nov 2010 09:37:13 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1029980 - /shindig/trunk/php/src/gadgets/MakeRequestHandler.php Date: Tue, 02 Nov 2010 09:37:13 -0000 To: castroshelia@example.net From: castroshelia@example.net X-Mailer: svnmailer-1.0.8 Message-Id: <castroshelia@example.net> Author: bhofmann Date: Tue Nov 2 09:37:13 2010 New Revision: 1029980 URL: http://svn.apache.org/viewvc?rev=1029980&view=rev Log: SHINDIG-1458: fixed utf8 over decoding in MakeRequestHandler Modified: shindig/trunk/php/src/gadgets/MakeRequestHandler.php Modified: shindig/trunk/php/src/gadgets/MakeRequestHandler.php URL: http://svn.apache.org/viewvc/shindig/trunk/php/src/gadgets/MakeRequestHandler.php?rev=1029980&r1=1029979&r2=1029980&view=diff ============================================================================== --- shindig/trunk/php/src/gadgets/MakeRequestHandler.php (original) +++ shindig/trunk/php/src/gadgets/MakeRequestHandler.php Tue Nov 2 09:37:13 2010 @@ -54,9 +54,6 @@ class MakeRequestHandler extends ProxyBa $responseArray = array_merge($responseArray, $result->getMetadatas()); $json = array($params->getHref() => $responseArray); $json = json_encode($json); - if (strpos($json, '\u')) { - $json = $this->makeRequest->decodeUtf8($json); - } $output = UNPARSEABLE_CRUFT . $json; if ($responseArray['rc'] == 200) { // only set caching headers if the result was 'OK' From commitscastroshelia@example.net Tue Nov 02 09:42:01 2010 Return-Path: <commitscastroshelia@example.net> Delivered-To: castroshelia@example.net Received: (qmail 91651 invoked from network); 2 Nov 2010 09:42:00 -0000 Received: from unknown (HELO mail.apache.org) (83.161.120.155) by 83.161.120.155 with SMTP; 2 Nov 2010 09:42:00 -0000 Received: (qmail 72156 invoked by uid 500); 2 Nov 2010 09:42:32 -0000 Delivered-To: castroshelia@example.net Received: (qmail 72110 invoked by uid 500); 2 Nov 2010 09:42:30 -0000 Mailing-List: contact castroshelia@example.net; run by ezmlm Precedence: bulk List-Help: <mailto:castroshelia@example.net> List-Unsubscribe: <mailto:castroshelia@example.net> List-Post: <mailto:castroshelia@example.net> List-Id: <commits.shindig.apache.org> Reply-To: castroshelia@example.net Delivered-To: mailing list castroshelia@example.net Received: (qmail 72103 invoked by uid 99); 2 Nov 2010 09:42:29 -0000 Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Nov 2010 09:42:29 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Nov 2010 09:42:29 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 72EDF23889E3; Tue, 2 Nov 2010 09:41:15 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1029982 - in /shindig/trunk/php/src/gadgets: GadgetFeatureRegistry.php GadgetSpecParser.php oauth/OAuthFetcher.php Date: Tue, 02 Nov 2010 09:41:15 -0000 To: castroshelia@example.net From: castroshelia@example.net X-Mailer: svnmailer-1.0.8 Message-Id: <castroshelia@example.net> Author: bhofmann Date: Tue Nov 2 09:41:14 2010 New Revision: 1029982 URL: http://svn.apache.org/viewvc?rev=1029982&view=rev Log: PHP: small changes to allow better enhancement for container specific implementations Modified: shindig/trunk/php/src/gadgets/GadgetFeatureRegistry.php shindig/trunk/php/src/gadgets/GadgetSpecParser.php shindig/trunk/php/src/gadgets/oauth/OAuthFetcher.php Modified: shindig/trunk/php/src/gadgets/GadgetFeatureRegistry.php URL: http://svn.apache.org/viewvc/shindig/trunk/php/src/gadgets/GadgetFeatureRegistry.php?rev=1029982&r1=1029981&r2=1029982&view=diff ============================================================================== --- shindig/trunk/php/src/gadgets/GadgetFeatureRegistry.php (original) +++ shindig/trunk/php/src/gadgets/GadgetFeatureRegistry.php Tue Nov 2 09:41:14 2010 @@ -62,7 +62,7 @@ class GadgetFeatureRegistry { return ''; } $ret = ''; - if (Config888a:dbb7:2d49:b3f6:8605:bf4e:caed:e5a4get('compress_javascript')) { + if (Config888a:dbb7:2d49:b3f6:8605:bf4e:caed:e5a4get('compress_javascript') && ! isset($_GET['debug'])) { $featureCache = Cach888a:dbb7:2d49:b3f6:8605:bf4e:caed:e5a4createCache(Config888a:dbb7:2d49:b3f6:8605:bf4e:caed:e5a4get('feature_cache'), 'FeatureCache'); if (($featureContent = $featureCache->get(md5('features:'.$featureName.$isGadgetContext)))) { return $featureContent; @@ -87,7 +87,7 @@ class GadgetFeatureRegistry { break; } } - if (Config888a:dbb7:2d49:b3f6:8605:bf4e:caed:e5a4get('compress_javascript')) { + if (Config888a:dbb7:2d49:b3f6:8605:bf4e:caed:e5a4get('compress_javascript') && ! isset($_GET['debug'])) { $ret = JsMin888a:dbb7:2d49:b3f6:8605:bf4e:caed:e5a4minify($ret); $featureCache->set(md5('features:'.$featureName.$isGadgetContext), $ret); } Modified: shindig/trunk/php/src/gadgets/GadgetSpecParser.php URL: http://svn.apache.org/viewvc/shindig/trunk/php/src/gadgets/GadgetSpecParser.php?rev=1029982&r1=1029981&r2=1029982&view=diff ============================================================================== --- shindig/trunk/php/src/gadgets/GadgetSpecParser.php (original) +++ shindig/trunk/php/src/gadgets/GadgetSpecParser.php Tue Nov 2 09:41:14 2010 @@ -34,11 +34,13 @@ class GadgetSpecParser { * @param string $xmlContent */ public function parse($xmlContent, GadgetContext $context) { + $this->context = $context; libxml_use_internal_errors(true); $doc = new DOMDocument(); if (! $doc->loadXML($xmlContent, LIBXML_NOCDATA)) { throw new GadgetSpecException("Error parsing gadget xml:\n" . XmlError888a:dbb7:2d49:b3f6:8605:bf4e:caed:e5a4getErrors($xmlContent)); } + //TODO: we could do a XSD schema validation here, but both the schema and most of the gadgets seem to have some form of schema // violatons, so it's not really practical yet (and slow) // $doc->schemaValidate('gadget.xsd'); @@ -190,6 +192,18 @@ class GadgetSpecParser { $this->parsePreloads($modulePrefs, $gadget); $this->parseLocales($modulePrefs, $gadget); $this->parseOAuth($modulePrefs, $gadget); + $this->parseContainerSpecific($modulePrefs, $gadget); + } + + /** + * Parses optional container specific moduleprefs + * override if needed + * + * @param DOMElement $modulePrefs + * @param Gadget $gadget + */ + protected function parseContainerSpecific(DOMElement &$modulePrefs, GadgetSpec &$gadget) { + } /** Modified: shindig/trunk/php/src/gadgets/oauth/OAuthFetcher.php URL: http://svn.apache.org/viewvc/shindig/trunk/php/src/gadgets/oauth/OAuthFetcher.php?rev=1029982&r1=1029981&r2=1029982&view=diff ============================================================================== --- shindig/trunk/php/src/gadgets/oauth/OAuthFetcher.php (original) +++ shindig/trunk/php/src/gadgets/oauth/OAuthFetcher.php Tue Nov 2 09:41:14 2010 @@ -19,7 +19,7 @@ */ // For TokenInfo -require 'src/gadgets/oauth/OAuthStore.php'; +require_once 'src/gadgets/oauth/OAuthStore.php'; /** * Implements the OAuth dance (http://oauth.net/core/1.0/) for gadgets. From commitscastroshelia@example.net Tue Nov 02 21:07:17 2010 Return-Path: <commitscastroshelia@example.net> Delivered-To: castroshelia@example.net Received: (qmail 79223 invoked from network); 2 Nov 2010 21:07:17 -0000 Received: from unknown (HELO mail.apache.org) (83.161.120.155) by 83.161.120.155 with SMTP; 2 Nov 2010 21:07:17 -0000 Received: (qmail 43929 invoked by uid 500); 2 Nov 2010 21:07:48 -0000 Delivered-To: castroshelia@example.net Received: (qmail 43884 invoked by uid 500); 2 Nov 2010 21:07:47 -0000 Mailing-List: contact castroshelia@example.net; run by ezmlm Precedence: bulk List-Help: <mailto:castroshelia@example.net> List-Unsubscribe: <mailto:castroshelia@example.net> List-Post: <mailto:castroshelia@example.net> List-Id: <commits.shindig.apache.org> Reply-To: castroshelia@example.net Delivered-To: mailing list castroshelia@example.net Received: (qmail 43877 invoked by uid 99); 2 Nov 2010 21:07:47 -0000 Received: from nike.apache.org (HELO nike.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Nov 2010 21:07:47 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Nov 2010 21:07:44 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 96ADD23889ED; Tue, 2 Nov 2010 21:06:30 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1030218 - in /shindig/trunk/features/src/main/javascript/features/rpc: rpc.js wpm.transport.js Date: Tue, 02 Nov 2010 21:06:30 -0000 To: castroshelia@example.net From: castroshelia@example.net X-Mailer: svnmailer-1.0.8 Message-Id: <castroshelia@example.net> X-Virus-Checked: Checked by ClamAV on apache.org Author: johnh Date: Tue Nov 2 21:06:30 2010 New Revision: 1030218 URL: http://svn.apache.org/viewvc?rev=1030218&view=rev Log: Adds support to gadgets.rpc for sending messages to a sibling IFRAME, rather than always to parent. The syntax used to do so is to send a message to "/<siblingId>", fully enshrining "/" as an invalid character in an IFRAME name/ID (as should already be the case). Only window.postMessage is updated to support direct messaging in this way, in this CL. As such, the support should be considered provisional, and used only by those who acknowledge this limitation. Tested on Chrome 7, Firefox 3.6 and IE 8. Modified: shindig/trunk/features/src/main/javascript/features/rpc/rpc.js shindig/trunk/features/src/main/javascript/features/rpc/wpm.transport.js Modified: shindig/trunk/features/src/main/javascript/features/rpc/rpc.js URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/rpc/rpc.js?rev=1030218&r1=1030217&r2=1030218&view=diff ============================================================================== --- shindig/trunk/features/src/main/javascript/features/rpc/rpc.js (original) +++ shindig/trunk/features/src/main/javascript/features/rpc/rpc.js Tue Nov 2 21:06:30 2010 @@ -28,7 +28,7 @@ * to the core gadgets.rpc library by various build rules. * * Transports used by core gadgets.rpc code to actually pass messages. - * each transport implements the same interface exposing hooks that + * Each transport implements the same interface exposing hooks that * the core library calls at strategic points to set up and use * the transport. * @@ -93,6 +93,12 @@ if (!gadgets.rpc) { // make lib resilien */ var SETUP_FRAME_MAX_TRIES = 10; + /** + * @const + * @private + */ + var ID_ORIGIN_DELIMITER = '|'; + var services = {}; var relayUrl = {}; var useLegacyProtocol = {}; @@ -359,12 +365,39 @@ if (!gadgets.rpc) { // make lib resilien return protocol + '://' + host + portStr; } + /* + * Makes a sibling id in the format of "/<siblingFrameId>|<siblingOrigin>". + */ + function makeSiblingId(id, opt_origin) { + return '/' + id + (opt_origin ? ID_ORIGIN_DELIMITER + opt_origin : ''); + } + + /* + * Parses an iframe id. Returns null if not a sibling id or + * {id: <siblingId>, origin: <siblingOrigin>} otherwise. + */ + function parseSiblingId(id) { + if (id[0] == '/') { + var delimiter = id.indexOf(ID_ORIGIN_DELIMITER); + var siblingId = delimiter > 0 ? id.substring(1, delimiter) : id.substring(1); + var origin = delimiter > 0 ? id.substring(delimiter + 1) : null; + return {id: siblingId, origin: origin}; + } else { + return null; + } + } + function getTargetWin(id) { if (typeof id === 'undefined' || id === '..') { return window.parent; } + var siblingId = parseSiblingId(id); + if (siblingId) { + return window.top.frames[siblingId.id]; + } + // Cast to a String to avoid an index lookup. id = String(id); @@ -416,7 +449,7 @@ if (!gadgets.rpc) { // make lib resilien setup[frameId] = 0; } - var tgtFrame = document.getElementById(frameId); + var tgtFrame = getTargetWin(frameId); if (frameId === '..' || tgtFrame != null) { if (transport.setup(frameId, token, forcesecure) === true) { setup[frameId] = true; @@ -596,13 +629,16 @@ if (!gadgets.rpc) { // make lib resilien } function setupChildIframe(gadgetId, opt_frameurl, opt_authtoken, opt_forcesecure) { - if (!gadgets.util) { - return; - } - var childIframe = document.getElementById(gadgetId); - if (!childIframe) { - throw new Error('Cannot set up gadgets.rpc receiver with ID: ' + gadgetId + - ', element not found.'); + if (gadgetId[0] != '/') { + // only set up child (and not sibling) iframe + if (!gadgets.util) { + return; + } + var childIframe = document.getElementById(gadgetId); + if (!childIframe) { + throw new Error('Cannot set up gadgets.rpc receiver with ID: ' + gadgetId + + ', element not found.'); + } } // The "relay URL" can either be explicitly specified or is set as @@ -611,7 +647,7 @@ if (!gadgets.rpc) { // make lib resilien setRelayUrl(gadgetId, relayUrl); // The auth token is parsed from child params (rpctoken) or overridden. - var childParams = gadgets.util.getUrlParameters(childIframe.src); + var childParams = gadgets.util.getUrlParameters(relayUrl); var rpctoken = opt_authtoken || childParams.rpctoken; var forcesecure = opt_forcesecure || childParams.forcesecure; setAuthToken(gadgetId, rpctoken, forcesecure); @@ -774,6 +810,9 @@ if (!gadgets.rpc) { // make lib resilien if (targetId === '..') { from = rpcId; + } else if (targetId[0] == '/') { + // sending to sibling + from = makeSiblingId(rpcId, gadgets.rpc.getOrigin(location.href)); } ++callId; @@ -947,6 +986,9 @@ if (!gadgets.rpc) { // make lib resilien /** Returns the window keyed by the ID. null/".." for parent, else child */ _getTargetWin: getTargetWin, + /** Parses a sibling id into {id: <siblingId>, origin: <siblingOrigin>} */ + _parseSiblingId: parseSiblingId, + /** Create an iframe for loading the relay URL. Used by child only. */ _createRelayIframe: function(token, data) { var relay = gadgets.rpc.getRelayUrl('..'); Modified: shindig/trunk/features/src/main/javascript/features/rpc/wpm.transport.js URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/rpc/wpm.transport.js?rev=1030218&r1=1030217&r2=1030218&view=diff ============================================================================== --- shindig/trunk/features/src/main/javascript/features/rpc/wpm.transport.js (original) +++ shindig/trunk/features/src/main/javascript/features/rpc/wpm.transport.js Tue Nov 2 21:06:30 2010 @@ -103,6 +103,22 @@ if (!gadgets.rpctx.wpm) { // make lib r process(rpc); } + function getTargetOrigin(id, parentUrl) { + var siblingId = gadgets.rpc._parseSiblingId(id); + if (siblingId) { + // sibling + return siblingId.origin; + } + + if (id == '..') { + // parent + return parentUrl; + } else { + // child + return document.getElementById(id).src; + } + } + return { getCode: function() { return 'wpm'; @@ -154,7 +170,7 @@ if (!gadgets.rpctx.wpm) { // make lib r var targetWin = gadgets.rpc._getTargetWin(targetId); // targetOrigin = canonicalized relay URL var origRelay = gadgets.rpc.getRelayUrl(targetId) || - gadgets.util.getUrlParameters()['parent']; + getTargetOrigin(targetId, gadgets.util.getUrlParameters()['parent']); var origin = gadgets.rpc.getOrigin(origRelay); if (origin) { postMessage(targetWin, gadgets.json.stringify(rpc), origin); From commitscastroshelia@example.net Tue Nov 02 22:15:32 2010 Return-Path: <commitscastroshelia@example.net> Delivered-To: castroshelia@example.net Received: (qmail 24577 invoked from network); 2 Nov 2010 22:15:32 -0000 Received: from unknown (HELO mail.apache.org) (83.161.120.155) by 83.161.120.155 with SMTP; 2 Nov 2010 22:15:32 -0000 Received: (qmail 50494 invoked by uid 500); 2 Nov 2010 22:16:03 -0000 Delivered-To: castroshelia@example.net Received: (qmail 50388 invoked by uid 500); 2 Nov 2010 22:16:03 -0000 Mailing-List: contact castroshelia@example.net; run by ezmlm Precedence: bulk List-Help: <mailto:castroshelia@example.net> List-Unsubscribe: <mailto:castroshelia@example.net> List-Post: <mailto:castroshelia@example.net> List-Id: <commits.shindig.apache.org> Reply-To: castroshelia@example.net Delivered-To: mailing list castroshelia@example.net Received: (qmail 50381 invoked by uid 99); 2 Nov 2010 22:16:03 -0000 Received: from nike.apache.org (HELO nike.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Nov 2010 22:16:03 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Nov 2010 22:16:01 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id D0C9323888EC; Tue, 2 Nov 2010 22:14:46 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1030260 - /shindig/trunk/pom.xml Date: Tue, 02 Nov 2010 22:14:46 -0000 To: castroshelia@example.net From: castroshelia@example.net X-Mailer: svnmailer-1.0.8 Message-Id: <castroshelia@example.net> X-Virus-Checked: Checked by ClamAV on apache.org Author: lindner Date: Tue Nov 2 22:14:46 2010 New Revision: 1030260 URL: http://svn.apache.org/viewvc?rev=1030260&view=rev Log: Henning to emeritus Modified: shindig/trunk/pom.xml Modified: shindig/trunk/pom.xml URL: http://svn.apache.org/viewvc/shindig/trunk/pom.xml?rev=1030260&r1=1030259&r2=1030260&view=diff ============================================================================== --- shindig/trunk/pom.xml (original) +++ shindig/trunk/pom.xml Tue Nov 2 22:14:46 2010 @@ -429,6 +429,16 @@ </roles> </developer> <!--Committers--> + <!--Emeritus--> + <developer> + <id>henning</id> + <name>Henning Schmiedehausen</name> + <email>castroshelia@example.net</email> + <organization>ASF</organization> + <roles> + <role>Emeritus</role> + </roles> + </developer> </developers> <!-- ====================================================================== --> From commitscastroshelia@example.net Tue Nov 02 22:18:13 2010 Return-Path: <commitscastroshelia@example.net> Delivered-To: castroshelia@example.net Received: (qmail 25576 invoked from network); 2 Nov 2010 22:18:13 -0000 Received: from unknown (HELO mail.apache.org) (83.161.120.155) by 83.161.120.155 with SMTP; 2 Nov 2010 22:18:13 -0000 Received: (qmail 54260 invoked by uid 500); 2 Nov 2010 22:18:45 -0000 Delivered-To: castroshelia@example.net Received: (qmail 54165 invoked by uid 500); 2 Nov 2010 22:18:44 -0000 Mailing-List: contact castroshelia@example.net; run by ezmlm Precedence: bulk List-Help: <mailto:castroshelia@example.net> List-Unsubscribe: <mailto:castroshelia@example.net> List-Post: <mailto:castroshelia@example.net> List-Id: <commits.shindig.apache.org> Reply-To: castroshelia@example.net Delivered-To: mailing list castroshelia@example.net Received: (qmail 54158 invoked by uid 99); 2 Nov 2010 22:18:44 -0000 Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Nov 2010 22:18:44 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Nov 2010 22:18:44 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id E41A123888EC; Tue, 2 Nov 2010 22:17:30 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1030263 - /shindig/trunk/COMMITTERS Date: Tue, 02 Nov 2010 22:17:30 -0000 To: castroshelia@example.net From: castroshelia@example.net X-Mailer: svnmailer-1.0.8 Message-Id: <castroshelia@example.net> Author: lindner Date: Tue Nov 2 22:17:30 2010 New Revision: 1030263 URL: http://svn.apache.org/viewvc?rev=1030263&view=rev Log: henning to emeritus Modified: shindig/trunk/COMMITTERS Modified: shindig/trunk/COMMITTERS URL: http://svn.apache.org/viewvc/shindig/trunk/COMMITTERS?rev=1030263&r1=1030262&r2=1030263&view=diff ============================================================================== --- shindig/trunk/COMMITTERS (original) +++ shindig/trunk/COMMITTERS Tue Nov 2 22:17:30 2010 @@ -11,7 +11,7 @@ Blanket commit access: lindner Paul Lindner castroshelia@example.net PMC Chair agektmr Eiji Kitamura castroshelia@example.net PMC Member - bhofmann Bastian Hoffman castroshelia@example.net PMC Member + bhofmann Bastian Hofmann castroshelia@example.net PMC Member brianm Brian McCallister castroshelia@example.net PMC Member Mentor chabotc Chris Chabot castroshelia@example.net PMC Member dbentley Daniel Bentley castroshelia@example.net PMC Member @@ -41,4 +41,5 @@ Blanket commit access: sylvain Sylvain Wallez castroshelia@example.net Mentor tomdz Thomas Dudziak castroshelia@example.net Mentor upayavira Upayavira castroshelia@example.net Mentor - dharkness David Harkness castroshelia@example.net Emeritus \ No newline at end of file + dharkness David Harkness castroshelia@example.net Emeritus + henning Henning castroshelia@example.net Emeritus \ No newline at end of file From commitscastroshelia@example.net Wed Nov 03 09:29:13 2010 Return-Path: <commitscastroshelia@example.net> Delivered-To: castroshelia@example.net Received: (qmail 58732 invoked from network); 3 Nov 2010 09:29:13 -0000 Received: from unknown (HELO mail.apache.org) (83.161.120.155) by 83.161.120.155 with SMTP; 3 Nov 2010 09:29:13 -0000 Received: (qmail 49217 invoked by uid 500); 3 Nov 2010 09:29:43 -0000 Delivered-To: castroshelia@example.net Received: (qmail 49032 invoked by uid 500); 3 Nov 2010 09:29:40 -0000 Mailing-List: contact castroshelia@example.net; run by ezmlm Precedence: bulk List-Help: <mailto:castroshelia@example.net> List-Unsubscribe: <mailto:castroshelia@example.net> List-Post: <mailto:castroshelia@example.net> List-Id: <commits.shindig.apache.org> Reply-To: castroshelia@example.net Delivered-To: mailing list castroshelia@example.net Received: (qmail 49013 invoked by uid 99); 3 Nov 2010 09:29:40 -0000 Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Nov 2010 09:29:40 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Nov 2010 09:29:39 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 294B3238890B; Wed, 3 Nov 2010 09:28:23 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1030372 - in /shindig/trunk/php: src/social/converters/OutputJsonConverter.php src/social/servlet/JsonRpcServlet.php test/social/OutputJsonConverterTest.php Date: Wed, 03 Nov 2010 09:28:23 -0000 To: castroshelia@example.net From: castroshelia@example.net X-Mailer: svnmailer-1.0.8 Message-Id: <castroshelia@example.net> Author: bhofmann Date: Wed Nov 3 09:28:22 2010 New Revision: 1030372 URL: http://svn.apache.org/viewvc?rev=1030372&view=rev Log: SHINDIG-1459: added JSONP support for PHP Shindig REST and RPC API Modified: shindig/trunk/php/src/social/converters/OutputJsonConverter.php shindig/trunk/php/src/social/servlet/JsonRpcServlet.php shindig/trunk/php/test/social/OutputJsonConverterTest.php Modified: shindig/trunk/php/src/social/converters/OutputJsonConverter.php URL: http://svn.apache.org/viewvc/shindig/trunk/php/src/social/converters/OutputJsonConverter.php?rev=1030372&r1=1030371&r2=1030372&view=diff ============================================================================== --- shindig/trunk/php/src/social/converters/OutputJsonConverter.php (original) +++ shindig/trunk/php/src/social/converters/OutputJsonConverter.php Wed Nov 3 09:28:22 2010 @@ -32,11 +32,7 @@ class OutputJsonConverter extends Output } // several service calls return a null value if (! is_null($response)) { - if (Config888a:dbb7:2d49:b3f6:8605:bf4e:caed:e5a4get('debug')) { - echo sel888a:dbb7:2d49:b3f6:8605:bf4e:caed:e5a4json_format(json_encode($response)); // TODO: add a query option to pretty-print json output - } else { - echo json_encode($response); - } + $this->encodeAndSendResponse($response); } } @@ -51,7 +47,25 @@ class OutputJsonConverter extends Output } function outputJsonBatch(Array $responses, SecurityToken $token) { - echo json_encode(array("responses" => $responses, "error" => false)); + $this->encodeAndSendResponse(array("responses" => $responses, "error" => false)); + } + + /** + * encodes data to json, adds jsonp callback if requested and sends response + * to client + * + * @param array $data + */ + private function encodeAndSendResponse($data) { + if (isset($_GET['callback']) && preg_match('/^[a-zA-Z0-9\_\.]*$/', $_GET['callback'])) { + echo $_GET['callback'] . '(' . json_encode($data) . ')'; + return; + } + if (Config888a:dbb7:2d49:b3f6:8605:bf4e:caed:e5a4get('debug')) { + echo sel888a:dbb7:2d49:b3f6:8605:bf4e:caed:e5a4json_format(json_encode($data)); // TODO: add a query option to pretty-print json output + } else { + echo json_encode($data); + } } /** Modified: shindig/trunk/php/src/social/servlet/JsonRpcServlet.php URL: http://svn.apache.org/viewvc/shindig/trunk/php/src/social/servlet/JsonRpcServlet.php?rev=1030372&r1=1030371&r2=1030372&view=diff ============================================================================== --- shindig/trunk/php/src/social/servlet/JsonRpcServlet.php (original) +++ shindig/trunk/php/src/social/servlet/JsonRpcServlet.php Wed Nov 3 09:28:22 2010 @@ -86,7 +86,7 @@ class JsonRpcServlet extends ApiServlet $responseItem = $this->getJSONResponse($key, $this->getResponseItem($responses[$i])); $result[] = $responseItem; } - echo json_encode($result); + $this->encodeAndSendResponse($result); } public function dispatch($request, $token) { @@ -99,7 +99,7 @@ class JsonRpcServlet extends ApiServlet // TODO: should use shared deadline across each request $response = $this->getResponseItem($this->handleRequestItem($requestItem)); $result = $this->getJSONResponse($key, $response); - echo json_encode($result); + $this->encodeAndSendResponse($result); } private function getJSONResponse($key, ResponseItem $responseItem) { @@ -136,9 +136,25 @@ class JsonRpcServlet extends ApiServlet return $error; } + /** + * encodes data to json, adds jsonp callback if requested and sends response + * to client + * + * @param array $data + */ + private function encodeAndSendResponse($data) { + // TODO: Refactor this class to use the OutputJsonConverter, so that we do not have to duplicate + // encoding and JSONP handling here + if (isset($_GET['callback']) && preg_match('/^[a-zA-Z0-9\_\.]*$/', $_GET['callback'])) { + echo $_GET['callback'] . '(' . json_encode($data) . ')'; + return; + } + echo json_encode($data); + } + public function sendError(ResponseItem $responseItem) { $error = $this->getErrorJson($responseItem); - echo json_encode($error); + $this->encodeAndSendResponse($error); } private function sendBadRequest($t, $response) { Modified: shindig/trunk/php/test/social/OutputJsonConverterTest.php URL: http://svn.apache.org/viewvc/shindig/trunk/php/test/social/OutputJsonConverterTest.php?rev=1030372&r1=1030371&r2=1030372&view=diff ============================================================================== --- shindig/trunk/php/test/social/OutputJsonConverterTest.php (original) +++ shindig/trunk/php/test/social/OutputJsonConverterTest.php Wed Nov 3 09:28:22 2010 @@ -74,5 +74,44 @@ class OutputJsonConverterTest extends PH $this->assertEquals($expectedJson, $outputJson); } + public function testOutputJsonPResponse() { + $_GET['callback'] = 'cb'; + $outputConverter = new OutputJsonConverter(); + $servletRequest = array('url' => '/people/1/@self'); + $token = BasicSecurityToken888a:dbb7:2d49:b3f6:8605:bf4e:caed:e5a4reateFromValues('owner', 'viewer', 'app', 'domain', 'appUrl', '1', 'default'); + $requestItem = RestRequestItem888a:dbb7:2d49:b3f6:8605:bf4e:caed:e5a4reateWithRequest($servletRequest, $token, 'convertJson', $outputConverter); + $requestItem->applyUrlTemplate("/people/{userId}/{groupId}/{personId}"); + $response = array( + 'entry' => array('isOwner' => false, 'isViewer' => false, 'displayName' => '1 1', + 'id' => '1')); + $responseItem = new ResponseItem(null, null, $response); + ob_start(); + $outputConverter->outputResponse($responseItem, $requestItem); + $output = ob_get_clean(); + $expected = 'cb({"entry":{"isOwner":false,"isViewer":false,"displayName":"1 1","id":"1"}})'; + unset($_GET['callback']); + $this->assertEquals($expected, $output); + } + + public function testOutputJsonPResponseWithInvalidCallback() { + $_GET['callback'] = 'alert(1);cb'; + $outputConverter = new OutputJsonConverter(); + $servletRequest = array('url' => '/people/1/@self'); + $token = BasicSecurityToken888a:dbb7:2d49:b3f6:8605:bf4e:caed:e5a4reateFromValues('owner', 'viewer', 'app', 'domain', 'appUrl', '1', 'default'); + $requestItem = RestRequestItem888a:dbb7:2d49:b3f6:8605:bf4e:caed:e5a4reateWithRequest($servletRequest, $token, 'convertJson', $outputConverter); + $requestItem->applyUrlTemplate("/people/{userId}/{groupId}/{personId}"); + $response = array( + 'entry' => array('isOwner' => false, 'isViewer' => false, 'displayName' => '1 1', + 'id' => '1')); + $responseItem = new ResponseItem(null, null, $response); + ob_start(); + $outputConverter->outputResponse($responseItem, $requestItem); + $output = ob_get_clean(); + $expected = '{"entry":{"isOwner":false,"isViewer":false,"displayName":"1 1","id":"1"}}'; + unset($_GET['callback']); + $outputJson = json_decode($output); + $expectedJson = json_decode($expected); + $this->assertEquals($expectedJson, $outputJson); + } } From commitscastroshelia@example.net Wed Nov 03 20:34:08 2010 Return-Path: <commitscastroshelia@example.net> Delivered-To: castroshelia@example.net Received: (qmail 7126 invoked from network); 3 Nov 2010 20:34:08 -0000 Received: from unknown (HELO mail.apache.org) (83.161.120.155) by 83.161.120.155 with SMTP; 3 Nov 2010 20:34:08 -0000 Received: (qmail 81057 invoked by uid 500); 3 Nov 2010 20:34:39 -0000 Delivered-To: castroshelia@example.net Received: (qmail 80995 invoked by uid 500); 3 Nov 2010 20:34:38 -0000 Mailing-List: contact castroshelia@example.net; run by ezmlm Precedence: bulk List-Help: <mailto:castroshelia@example.net> List-Unsubscribe: <mailto:castroshelia@example.net> List-Post: <mailto:castroshelia@example.net> List-Id: <commits.shindig.apache.org> Reply-To: castroshelia@example.net Delivered-To: mailing list castroshelia@example.net Received: (qmail 80982 invoked by uid 99); 3 Nov 2010 20:34:37 -0000 Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Nov 2010 20:34:37 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Nov 2010 20:34:36 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 6C6852388A64; Wed, 3 Nov 2010 20:33:23 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1030653 - in /shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet: JsHandler.java JsServlet.java Date: Wed, 03 Nov 2010 20:33:23 -0000 To: castroshelia@example.net From: castroshelia@example.net X-Mailer: svnmailer-1.0.8 Message-Id: <castroshelia@example.net> Author: johnh Date: Wed Nov 3 20:33:23 2010 New Revision: 1030653 URL: http://svn.apache.org/viewvc?rev=1030653&view=rev Log: Remove dependency of JsHandler on HttpServletRequest. Makes it much easier to re-use JsHandler's in tools, metadata API, etc. Modified: shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/JsHandler.java shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/JsServlet.java Modified: shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/JsHandler.java URL: http://svn.apache.org/viewvc/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/JsHandler.java?rev=1030653&r1=1030652&r2=1030653&view=diff ============================================================================== --- shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/JsHandler.java (original) +++ shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/JsHandler.java Wed Nov 3 20:33:23 2010 @@ -17,7 +17,6 @@ */ package org.apache.shindig.gadgets.servlet; -import org.apache.commons.lang.StringUtils; import org.apache.shindig.common.JsonSerializer; import org.apache.shindig.config.ContainerConfig; import org.apache.shindig.gadgets.GadgetContext; @@ -25,13 +24,11 @@ import org.apache.shindig.gadgets.Render import org.apache.shindig.gadgets.config.ConfigContributor; import org.apache.shindig.gadgets.features.FeatureRegistry; import org.apache.shindig.gadgets.features.FeatureResource; +import org.apache.shindig.gadgets.uri.JsUriManager.JsUri; -import javax.servlet.http.HttpServletRequest; import java.util.Collection; import java.util.Map; -import java.util.Set; -import com.google.common.collect.ImmutableSet; import com.google.common.collect.Maps; import com.google.inject.Inject; import com.google.inject.Singleton; @@ -54,62 +51,6 @@ public class JsHandler { this.containerConfig = containerConfig; this.configContributors = configContributors; } - - /** - * Get the JavaScript content from the feature name aliases. - * - * @param req the HttpRequest object. - * @return JsHandlerResponse object that contains JavaScript data and cacheable flag. - */ - public JsHandlerResponse getJsContent(final HttpServletRequest req) { - // get the Set of features needed from request - Set<String> needed = getFeaturesNeeded(req); - - // get the GadgetContext instance - GadgetContext ctx = getGadgetContext(req); - - // get js data from feature resoources. - return getFeatureResourcesContent(req, ctx, needed); - } - - /** - * Get the Set of feature names from the request. - * - * @param req the HttpServletRequest object. - * @return Set of names of needed JavaScript as feature aliases from the request. - */ - protected Set<String> getFeaturesNeeded(final HttpServletRequest req) { - // Use the last component as filename; prefix is ignored - String uri = req.getRequestURI(); - // We only want the file name part. There will always be at least 1 slash - // (the server root), so this is always safe. - String resourceName = uri.substring(uri.lastIndexOf('/') + 1); - if (resourceName.endsWith(".js")) { - // Lop off the suffix for lookup purposes - resourceName = resourceName.substring(0, resourceName.length() - ".js".length()); - } - - Set<String> needed = ImmutableSet.copyOf(StringUtils.split(resourceName, ':')); - return needed; - } - - /** - * Get the GadgetContext to be used when calling FeatureRegistry.getFeatureResources. - * - * @param req the HttpServletRequest object. - * @return GadgetContext instance. - */ - protected GadgetContext getGadgetContext(final HttpServletRequest req) { - String containerParam = req.getParameter("container"); - String containerStr = req.getParameter("c"); - - final RenderingContext context = "1".equals(containerStr) ? - RenderingContext.CONTAINER : RenderingContext.GADGET; - final String container = - containerParam != null ? containerParam : ContainerConfig.DEFAULT_CONTAINER; - - return new JsGadgetContext(context, container); - } /** * Get the content of the feature resources and push it to jsData. @@ -119,18 +60,17 @@ public class JsHandler { * @param needed Set of requested feature names. * @return JsHandlerResponse object that contains JavaScript data and cacheable flag. */ - protected JsHandlerResponse getFeatureResourcesContent(final HttpServletRequest req, - final GadgetContext ctx, Set<String> needed) { + protected Response getJsContent(final JsUri jsUri, String host) { + GadgetContext ctx = new JsGadgetContext(jsUri); StringBuilder jsData = new StringBuilder(); + Collection<String> needed = jsUri.getLibs(); Collection<? extends FeatureResource> resources = registry.getFeatureResources(ctx, needed, null); - String debugStr = req.getParameter("debug"); - boolean debug = "1".equals(debugStr); String container = ctx.getContainer(); boolean isProxyCacheable = true; for (FeatureResource featureResource : resources) { - String content = debug ? featureResource.getDebugContent() : featureResource.getContent(); + String content = jsUri.isDebug() ? featureResource.getDebugContent() : featureResource.getContent(); if (!featureResource.isExternal()) { jsData.append(content); } else { @@ -157,23 +97,23 @@ public class JsHandler { } ConfigContributor contributor = configContributors.get(name); if (contributor != null) { - contributor.contribute(config, container, req.getHeader("Host")); + contributor.contribute(config, container, host); } } jsData.append("gadgets.config.init(").append(JsonSerializer.serialize(config)).append(");\n"); } } - return new JsHandlerResponse(jsData, isProxyCacheable); + return new Response(jsData, isProxyCacheable); } /** * Define the response data from JsHandler. */ - public static class JsHandlerResponse { + public static class Response { private final boolean isProxyCacheable; private final StringBuilder jsData; - public JsHandlerResponse (StringBuilder jsData, boolean isProxyCacheable) { + public Response(StringBuilder jsData, boolean isProxyCacheable) { this.jsData = jsData; this.isProxyCacheable = isProxyCacheable; } @@ -194,9 +134,9 @@ public class JsHandler { private final RenderingContext renderingContext; private final String container; - public JsGadgetContext(RenderingContext renderingContext, String container) { - this.renderingContext = renderingContext; - this.container = container; + public JsGadgetContext(JsUri ctx) { + this.renderingContext = ctx.getContext(); + this.container = ctx.getContainer(); } @Override Modified: shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/JsServlet.java URL: http://svn.apache.org/viewvc/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/JsServlet.java?rev=1030653&r1=1030652&r2=1030653&view=diff ============================================================================== --- shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/JsServlet.java (original) +++ shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/JsServlet.java Wed Nov 3 20:33:23 2010 @@ -131,7 +131,8 @@ public class JsServlet extends InjectedS } // Get JavaScript content from features aliases request. - JsHandler.JsHandlerResponse handlerResponse = jsHandler.getJsContent(req); + JsHandler.Response handlerResponse = + jsHandler.getJsContent(jsUri, req.getHeader("Host")); StringBuilder jsData = handlerResponse.getJsData(); boolean isProxyCacheable = handlerResponse.isProxyCacheable(); @@ -189,7 +190,6 @@ public class JsServlet extends InjectedS } private int getCacheTtlSecs(JsUri jsUri) { - int refresh; if (jsUri.isNoCache()) { return 0; } else { From commitscastroshelia@example.net Wed Nov 03 21:50:44 2010 Return-Path: <commitscastroshelia@example.net> Delivered-To: castroshelia@example.net Received: (qmail 4247 invoked from network); 3 Nov 2010 21:50:44 -0000 Received: from unknown (HELO mail.apache.org) (83.161.120.155) by 83.161.120.155 with SMTP; 3 Nov 2010 21:50:44 -0000 Received: (qmail 52086 invoked by uid 500); 3 Nov 2010 21:51:15 -0000 Delivered-To: castroshelia@example.net Received: (qmail 51944 invoked by uid 500); 3 Nov 2010 21:51:13 -0000 Mailing-List: contact castroshelia@example.net; run by ezmlm Precedence: bulk List-Help: <mailto:castroshelia@example.net> List-Unsubscribe: <mailto:castroshelia@example.net> List-Post: <mailto:castroshelia@example.net> List-Id: <commits.shindig.apache.org> Reply-To: castroshelia@example.net Delivered-To: mailing list castroshelia@example.net Received: (qmail 51935 invoked by uid 99); 3 Nov 2010 21:51:13 -0000 Received: from nike.apache.org (HELO nike.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Nov 2010 21:51:13 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Nov 2010 21:49:32 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 672C92388B3A; Wed, 3 Nov 2010 21:48:18 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1030718 - in /shindig/trunk: java/samples/pom.xml pom.xml Date: Wed, 03 Nov 2010 21:48:18 -0000 To: castroshelia@example.net From: castroshelia@example.net X-Mailer: svnmailer-1.0.8 Message-Id: <castroshelia@example.net> X-Virus-Checked: Checked by ClamAV on apache.org Author: lindner Date: Wed Nov 3 21:48:18 2010 New Revision: 1030718 URL: http://svn.apache.org/viewvc?rev=1030718&view=rev Log: bump versions, start trying to fix samples Modified: shindig/trunk/java/samples/pom.xml shindig/trunk/pom.xml Modified: shindig/trunk/java/samples/pom.xml URL: http://svn.apache.org/viewvc/shindig/trunk/java/samples/pom.xml?rev=1030718&r1=1030717&r2=1030718&view=diff ============================================================================== --- shindig/trunk/java/samples/pom.xml (original) +++ shindig/trunk/java/samples/pom.xml Wed Nov 3 21:48:18 2010 @@ -111,7 +111,7 @@ <dependency> <groupId>org.apache.derby</groupId> <artifactId>derby</artifactId> - <version>83.161.120.155</version> + <version>83.161.120.155</version> </dependency> <dependency> <groupId>commons-dbcp</groupId> @@ -162,7 +162,7 @@ <dependency> <groupId>org.hibernate</groupId> <artifactId>ejb3-persistence</artifactId> - <version>1.0.1.GA</version> + <version>1.0.2.GA</version> </dependency> <!-- test --> Modified: shindig/trunk/pom.xml URL: http://svn.apache.org/viewvc/shindig/trunk/pom.xml?rev=1030718&r1=1030717&r2=1030718&view=diff ============================================================================== --- shindig/trunk/pom.xml (original) +++ shindig/trunk/pom.xml Wed Nov 3 21:48:18 2010 @@ -1558,7 +1558,7 @@ <dependency> <groupId>joda-time</groupId> <artifactId>joda-time</artifactId> - <version>1.6</version> + <version>1.6.2</version> </dependency> <dependency> <groupId>rome</groupId> @@ -1649,7 +1649,7 @@ <dependency> <groupId>xml-apis</groupId> <artifactId>xml-apis</artifactId> - <version>1.3.04</version> + <version>2.0.2</version> </dependency> <dependency> <groupId>org.apache.httpcomponents</groupId> From commitscastroshelia@example.net Wed Nov 03 21:50:44 2010 Return-Path: <commitscastroshelia@example.net> Delivered-To: castroshelia@example.net Received: (qmail 4249 invoked from network); 3 Nov 2010 21:50:44 -0000 Received: from unknown (HELO mail.apache.org) (83.161.120.155) by 83.161.120.155 with SMTP; 3 Nov 2010 21:50:44 -0000 Received: (qmail 52085 invoked by uid 500); 3 Nov 2010 21:51:15 -0000 Delivered-To: castroshelia@example.net Received: (qmail 51976 invoked by uid 500); 3 Nov 2010 21:51:15 -0000 Mailing-List: contact castroshelia@example.net; run by ezmlm Precedence: bulk List-Help: <mailto:castroshelia@example.net> List-Unsubscribe: <mailto:castroshelia@example.net> List-Post: <mailto:castroshelia@example.net> List-Id: <commits.shindig.apache.org> Reply-To: castroshelia@example.net Delivered-To: mailing list castroshelia@example.net Received: (qmail 51968 invoked by uid 99); 3 Nov 2010 21:51:15 -0000 Received: from nike.apache.org (HELO nike.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Nov 2010 21:51:15 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Nov 2010 21:49:38 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 904652388B6C; Wed, 3 Nov 2010 21:48:24 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1030719 - in /shindig/trunk/java/gadgets/src: main/java/org/apache/shindig/gadgets/oauth/ main/java/org/apache/shindig/gadgets/servlet/ test/java/org/apache/shindig/gadgets/servlet/ Date: Wed, 03 Nov 2010 21:48:24 -0000 To: castroshelia@example.net From: castroshelia@example.net X-Mailer: svnmailer-1.0.8 Message-Id: <castroshelia@example.net> X-Virus-Checked: Checked by ClamAV on apache.org Author: lindner Date: Wed Nov 3 21:48:24 2010 New Revision: 1030719 URL: http://svn.apache.org/viewvc?rev=1030719&view=rev Log: openjdk 6 workaround for generics bug Modified: shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/oauth/OAuthArguments.java shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/HttpRequestHandler.java shindig/trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/servlet/MakeRequestHandlerTest.java Modified: shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/oauth/OAuthArguments.java URL: http://svn.apache.org/viewvc/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/oauth/OAuthArguments.java?rev=1030719&r1=1030718&r2=1030719&view=diff ============================================================================== --- shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/oauth/OAuthArguments.java (original) +++ shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/oauth/OAuthArguments.java Wed Nov 3 21:48:24 2010 @@ -24,10 +24,9 @@ import org.apache.shindig.gadgets.Gadget import org.apache.shindig.gadgets.http.HttpResponse; import org.apache.shindig.gadgets.spec.RequestAuthenticationInfo; -import com.google.common.collect.Maps; - import java.util.Enumeration; import java.util.Map; +import java.util.TreeMap; import javax.servlet.http.HttpServletRequest; @@ -94,7 +93,7 @@ public class OAuthArguments { private boolean signViewer = false; /** Arbitrary name/value pairs associated with the request */ - private final Map<String, String> requestOptions = Maps.newTreeMap(String.CASE_INSENSITIVE_ORDER); + private final Map<String, String> requestOptions = new TreeMap<String,String>(String.CASE_INSENSITIVE_ORDER); /** Whether the request is one for proxied content */ private boolean proxiedContentRequest = false; Modified: shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/HttpRequestHandler.java URL: http://svn.apache.org/viewvc/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/HttpRequestHandler.java?rev=1030719&r1=1030718&r2=1030719&view=diff ============================================================================== --- shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/HttpRequestHandler.java (original) +++ shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/HttpRequestHandler.java Wed Nov 3 21:48:24 2010 @@ -41,9 +41,10 @@ import org.json.JSONException; import org.json.JSONObject; import java.util.Collection; +import java.util.List; import java.util.Map; import java.util.Set; -import java.util.List; +import java.util.TreeMap; import javax.servlet.http.HttpServletResponse; @@ -491,7 +492,7 @@ public class HttpRequestHandler { */ public HttpApiResponse(HttpResponse response, Object content, HttpApiRequest httpApiRequest) { this.status = response.getHttpStatusCode(); - this.headers = Maps.newTreeMap(String.CASE_INSENSITIVE_ORDER); + this.headers = new TreeMap<String, Collection<String>>(String.CASE_INSENSITIVE_ORDER); if (response.getHeaders().containsKey("set-cookie")) { this.headers.put("set-cookie", response.getHeaders("set-cookie")); Modified: shindig/trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/servlet/MakeRequestHandlerTest.java URL: http://svn.apache.org/viewvc/shindig/trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/servlet/MakeRequestHandlerTest.java?rev=1030719&r1=1030718&r2=1030719&view=diff ============================================================================== --- shindig/trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/servlet/MakeRequestHandlerTest.java (original) +++ shindig/trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/servlet/MakeRequestHandlerTest.java Wed Nov 3 21:48:24 2010 @@ -23,7 +23,6 @@ import static org.easymock.EasyMock.capt import static org.easymock.EasyMock.expect; import com.google.common.collect.Lists; -import com.google.common.collect.Maps; import org.apache.shindig.auth.AuthInfo; import org.apache.shindig.auth.SecurityToken; @@ -50,6 +49,7 @@ import java.util.Collections; import java.util.Enumeration; import java.util.List; import java.util.Map; +import java.util.TreeMap; import javax.servlet.http.HttpServletRequest; @@ -522,7 +522,7 @@ public class MakeRequestHandlerTest exte @Test public void testSetResponseHeadersNoCache() throws Exception { - Map<String, List<String>> headers = Maps.newTreeMap(String.CASE_INSENSITIVE_ORDER); + Map<String, List<String>> headers = new TreeMap<String,List<String>>(String.CASE_INSENSITIVE_ORDER); headers.put("Pragma", Arrays.asList("no-cache")); HttpResponse results = new HttpResponseBuilder() .addHeader("Pragma", "no-cache") From commitscastroshelia@example.net Wed Nov 03 22:49:22 2010 Return-Path: <commitscastroshelia@example.net> Delivered-To: castroshelia@example.net Received: (qmail 42715 invoked from network); 3 Nov 2010 22:49:22 -0000 Received: from unknown (HELO mail.apache.org) (83.161.120.155) by 83.161.120.155 with SMTP; 3 Nov 2010 22:49:22 -0000 Received: (qmail 17264 invoked by uid 500); 3 Nov 2010 22:49:53 -0000 Delivered-To: castroshelia@example.net Received: (qmail 17223 invoked by uid 500); 3 Nov 2010 22:49:52 -0000 Mailing-List: contact castroshelia@example.net; run by ezmlm Precedence: bulk List-Help: <mailto:castroshelia@example.net> List-Unsubscribe: <mailto:castroshelia@example.net> List-Post: <mailto:castroshelia@example.net> List-Id: <commits.shindig.apache.org> Reply-To: castroshelia@example.net Delivered-To: mailing list castroshelia@example.net Received: (qmail 17216 invoked by uid 99); 3 Nov 2010 22:49:52 -0000 Received: from nike.apache.org (HELO nike.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Nov 2010 22:49:52 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Nov 2010 22:49:49 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id AFAA723889E1; Wed, 3 Nov 2010 22:48:35 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1030747 - /shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/HttpResponse.java Date: Wed, 03 Nov 2010 22:48:35 -0000 To: castroshelia@example.net From: castroshelia@example.net X-Mailer: svnmailer-1.0.8 Message-Id: <castroshelia@example.net> X-Virus-Checked: Checked by ClamAV on apache.org Author: lindner Date: Wed Nov 3 22:48:35 2010 New Revision: 1030747 URL: http://svn.apache.org/viewvc?rev=1030747&view=rev Log: openjdk 6 workaround for generics bug Modified: shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/HttpResponse.java Modified: shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/HttpResponse.java URL: http://svn.apache.org/viewvc/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/HttpResponse.java?rev=1030747&r1=1030746&r2=1030747&view=diff ============================================================================== --- shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/HttpResponse.java (original) +++ shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/HttpResponse.java Wed Nov 3 22:48:35 2010 @@ -653,7 +653,7 @@ public final class HttpResponse implemen } } public static Multimap<String,String> newHeaderMultimap() { - TreeMap<String,Collection<String>> map = Maps.newTreeMap(String.CASE_INSENSITIVE_ORDER); + TreeMap<String,Collection<String>> map = new TreeMap<String,Collection<String>>(String.CASE_INSENSITIVE_ORDER); return Multimaps.newMultimap(map, HEADER_COLLECTION_SUPPLIER); } } From commitscastroshelia@example.net Wed Nov 03 23:08:47 2010 Return-Path: <commitscastroshelia@example.net> Delivered-To: castroshelia@example.net Received: (qmail 58055 invoked from network); 3 Nov 2010 23:08:47 -0000 Received: from unknown (HELO mail.apache.org) (83.161.120.155) by 83.161.120.155 with SMTP; 3 Nov 2010 23:08:47 -0000 Received: (qmail 38641 invoked by uid 500); 3 Nov 2010 23:09:18 -0000 Delivered-To: castroshelia@example.net Received: (qmail 38615 invoked by uid 500); 3 Nov 2010 23:09:18 -0000 Mailing-List: contact castroshelia@example.net; run by ezmlm Precedence: bulk List-Help: <mailto:castroshelia@example.net> List-Unsubscribe: <mailto:castroshelia@example.net> List-Post: <mailto:castroshelia@example.net> List-Id: <commits.shindig.apache.org> Reply-To: castroshelia@example.net Delivered-To: mailing list castroshelia@example.net Received: (qmail 38608 invoked by uid 99); 3 Nov 2010 23:09:18 -0000 Received: from nike.apache.org (HELO nike.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Nov 2010 23:09:18 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Nov 2010 23:09:16 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 77E8323889E3; Wed, 3 Nov 2010 23:08:02 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1030751 - /shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/HttpRequest.java Date: Wed, 03 Nov 2010 23:08:02 -0000 To: castroshelia@example.net From: castroshelia@example.net X-Mailer: svnmailer-1.0.8 Message-Id: <castroshelia@example.net> X-Virus-Checked: Checked by ClamAV on apache.org Author: johnh Date: Wed Nov 3 23:08:02 2010 New Revision: 1030751 URL: http://svn.apache.org/viewvc?rev=1030751&view=rev Log: Another workaround for openJDK bug. Modified: shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/HttpRequest.java Modified: shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/HttpRequest.java URL: http://svn.apache.org/viewvc/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/HttpRequest.java?rev=1030751&r1=1030750&r2=1030751&view=diff ============================================================================== --- shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/HttpRequest.java (original) +++ shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/HttpRequest.java Wed Nov 3 23:08:02 2010 @@ -38,6 +38,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Map; +import java.util.TreeMap; /** * Creates HttpRequests. A new HttpRequest should be created for every unique HttpRequest @@ -50,7 +51,7 @@ public class HttpRequest { private String method = "GET"; private Uri uri; - private final Map<String, List<String>> headers = Maps.newTreeMap(String.CASE_INSENSITIVE_ORDER); + private final Map<String, List<String>> headers = new TreeMap<String, List<String>>(String.CASE_INSENSITIVE_ORDER); // Internal parameters which serve as extra information to pass along the // chain of HttpRequest processing. From commitscastroshelia@example.net Wed Nov 03 23:14:13 2010 Return-Path: <commitscastroshelia@example.net> Delivered-To: castroshelia@example.net Received: (qmail 61909 invoked from network); 3 Nov 2010 23:14:13 -0000 Received: from unknown (HELO mail.apache.org) (83.161.120.155) by 83.161.120.155 with SMTP; 3 Nov 2010 23:14:13 -0000 Received: (qmail 46959 invoked by uid 500); 3 Nov 2010 23:14:44 -0000 Delivered-To: castroshelia@example.net Received: (qmail 46940 invoked by uid 500); 3 Nov 2010 23:14:44 -0000 Mailing-List: contact castroshelia@example.net; run by ezmlm Precedence: bulk List-Help: <mailto:castroshelia@example.net> List-Unsubscribe: <mailto:castroshelia@example.net> List-Post: <mailto:castroshelia@example.net> List-Id: <commits.shindig.apache.org> Reply-To: castroshelia@example.net Delivered-To: mailing list castroshelia@example.net Received: (qmail 46933 invoked by uid 99); 3 Nov 2010 23:14:44 -0000 Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Nov 2010 23:14:44 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Nov 2010 23:14:43 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 39B2623889E3; Wed, 3 Nov 2010 23:13:30 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1030753 - /shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/JsHandler.java Date: Wed, 03 Nov 2010 23:13:30 -0000 To: castroshelia@example.net From: castroshelia@example.net X-Mailer: svnmailer-1.0.8 Message-Id: <castroshelia@example.net> Author: johnh Date: Wed Nov 3 23:13:29 2010 New Revision: 1030753 URL: http://svn.apache.org/viewvc?rev=1030753&view=rev Log: Make getJsContent public (again). Thanks to Henry for the catch. Modified: shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/JsHandler.java Modified: shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/JsHandler.java URL: http://svn.apache.org/viewvc/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/JsHandler.java?rev=1030753&r1=1030752&r2=1030753&view=diff ============================================================================== --- shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/JsHandler.java (original) +++ shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/JsHandler.java Wed Nov 3 23:13:29 2010 @@ -60,7 +60,7 @@ public class JsHandler { * @param needed Set of requested feature names. * @return JsHandlerResponse object that contains JavaScript data and cacheable flag. */ - protected Response getJsContent(final JsUri jsUri, String host) { + public Response getJsContent(final JsUri jsUri, String host) { GadgetContext ctx = new JsGadgetContext(jsUri); StringBuilder jsData = new StringBuilder(); Collection<String> needed = jsUri.getLibs(); From commitscastroshelia@example.net Wed Nov 03 23:58:54 2010 Return-Path: <commitscastroshelia@example.net> Delivered-To: castroshelia@example.net Received: (qmail 78596 invoked from network); 3 Nov 2010 23:58:54 -0000 Received: from unknown (HELO mail.apache.org) (83.161.120.155) by 83.161.120.155 with SMTP; 3 Nov 2010 23:58:54 -0000 Received: (qmail 90553 invoked by uid 500); 3 Nov 2010 23:59:25 -0000 Delivered-To: castroshelia@example.net Received: (qmail 90534 invoked by uid 500); 3 Nov 2010 23:59:25 -0000 Mailing-List: contact castroshelia@example.net; run by ezmlm Precedence: bulk List-Help: <mailto:castroshelia@example.net> List-Unsubscribe: <mailto:castroshelia@example.net> List-Post: <mailto:castroshelia@example.net> List-Id: <commits.shindig.apache.org> Reply-To: castroshelia@example.net Delivered-To: mailing list castroshelia@example.net Received: (qmail 90527 invoked by uid 99); 3 Nov 2010 23:59:25 -0000 Received: from nike.apache.org (HELO nike.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Nov 2010 23:59:25 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Nov 2010 23:59:22 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 9946723889E7; Wed, 3 Nov 2010 23:58:08 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1030766 - in /shindig/trunk/php: src/gadgets/templates/DataPipelining.php test/gadgets/DataPipeliningTest.php Date: Wed, 03 Nov 2010 23:58:08 -0000 To: castroshelia@example.net From: castroshelia@example.net X-Mailer: svnmailer-1.0.8 Message-Id: <castroshelia@example.net> X-Virus-Checked: Checked by ClamAV on apache.org Author: bhofmann Date: Wed Nov 3 23:58:08 2010 New Revision: 1030766 URL: http://svn.apache.org/viewvc?rev=1030766&view=rev Log: SHINDIG-1462: added support for os:PersonAppDataRequest, fixed os:ViewerRequest Added: shindig/trunk/php/test/gadgets/DataPipeliningTest.php Modified: shindig/trunk/php/src/gadgets/templates/DataPipelining.php Modified: shindig/trunk/php/src/gadgets/templates/DataPipelining.php URL: http://svn.apache.org/viewvc/shindig/trunk/php/src/gadgets/templates/DataPipelining.php?rev=1030766&r1=1030765&r2=1030766&view=diff ============================================================================== --- shindig/trunk/php/src/gadgets/templates/DataPipelining.php (original) +++ shindig/trunk/php/src/gadgets/templates/DataPipelining.php Wed Nov 3 23:58:08 2010 @@ -34,7 +34,7 @@ class DataPipelining { $dataTags = $viewNode->getElementsByTagName('*'); if ($dataTags->length > 0) { $dataPipeliningTags = array(); - $namespaceErrorTags = array('httprequest', 'datarequest', 'peoplerequest', 'viewerrequest', 'ownerrequest', 'activitiesrequest'); + $namespaceErrorTags = array('httprequest', 'datarequest', 'peoplerequest', 'personappdatarequest', 'viewerrequest', 'ownerrequest', 'activitiesrequest'); foreach ($dataTags as $dataTag) { $tag = array(); $tag['type'] = $dataTag->tagName; @@ -58,12 +58,16 @@ class DataPipelining { $tag['type'] = 'os:DataRequest'; $tag['method'] = 'people.get'; break; + case 'os:PersonAppDataRequest': + $tag['type'] = 'os:DataRequest'; + $tag['method'] = 'appdata.get'; + break; case 'os:ViewerRequest': case 'os:OwnerRequest': - $tag['type'] = 'os:DataRequest'; $tag['method'] = 'people.get'; - $tag['userId'] = $tag['type'] == 'osViewerRequest' ? '@viewer' : '@owner'; + $tag['userId'] = $tag['type'] == 'os:ViewerRequest' ? '@viewer' : '@owner'; $tag['groupId'] = '@self'; + $tag['type'] = 'os:DataRequest'; break; case 'os:ActivitiesRequest': $tag['type'] = 'os:DataRequest'; Added: shindig/trunk/php/test/gadgets/DataPipeliningTest.php URL: http://svn.apache.org/viewvc/shindig/trunk/php/test/gadgets/DataPipeliningTest.php?rev=1030766&view=auto ============================================================================== --- shindig/trunk/php/test/gadgets/DataPipeliningTest.php (added) +++ shindig/trunk/php/test/gadgets/DataPipeliningTest.php Wed Nov 3 23:58:08 2010 @@ -0,0 +1,106 @@ +<?php +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * ContainerConfig test case. + */ +class DataPipeliningTest extends PHPUnit_Framework_TestCase { + /** + * @var Gadget + */ + private $viewNode = '<?xml version="1.0" encoding="UTF-8" ?> + <script xmlns:os="http://ns.opensocial.org/2008/markup" type="text/os-data"> + <os:PeopleRequest key="viewer" userId="@viewer" groupId="@self"/> + <os:PeopleRequest key="viewerFriends" userId="@viewer" groupId="@friends" foo="bar"/> + <os:ViewerRequest /> + <os:OwnerRequest /> + <os:PersonAppDataRequest key="appdata" userId="@viewer" fields="field" /> + <os:PersonAppDataRequest key="appdataFriends" userId="@viewer" groupId="@friends" fields="field" /> + <os:ActivitiesRequest /> + <os:HttpRequest href="http://example.com" /> + </script> + '; + + public function testParse() { + $doc = new DomDocument(); + $doc->loadXml($this->viewNode); + $contentBlocks = $doc->getElementsByTagName('script'); + $tags = array(); + foreach ($contentBlocks as $content) { + $tags[] = DataPipelining888a:dbb7:2d49:b3f6:8605:bf4e:caed:e5a4parse($content); + } + $this->assertEquals(1, count($tags)); + + $expected = array( + array( + 'type' => 'os:DataRequest', + 'key' => 'viewer', + 'userId' => '@viewer', + 'groupId' => '@self', + 'method' => 'people.get', + ), + array( + 'type' => 'os:DataRequest', + 'key' => 'viewerFriends', + 'userId' => '@viewer', + 'groupId' => '@friends', + 'method' => 'people.get', + ), + array( + 'type' => 'os:DataRequest', + 'method' => 'people.get', + 'userId' => '@viewer', + 'groupId' => '@self', + ), + array( + 'type' => 'os:DataRequest', + 'method' => 'people.get', + 'userId' => '@owner', + 'groupId' => '@self', + ), + array( + 'type' => 'os:DataRequest', + 'key' => 'appdata', + 'userId' => '@viewer', + 'fields' => 'field', + 'method' => 'appdata.get', + ), + array( + 'type' => 'os:DataRequest', + 'key' => 'appdataFriends', + 'userId' => '@viewer', + 'groupId' => '@friends', + 'fields' => 'field', + 'method' => 'appdata.get', + ), + array( + 'type' => 'os:DataRequest', + 'method' => 'activities.get', + ), + array( + 'type' => 'os:HttpRequest', + 'href' => 'http://example.com', + ), + ); + + $this->assertEquals($expected, $tags[0]); + + } +} From commitscastroshelia@example.net Thu Nov 04 00:31:27 2010 Return-Path: <commitscastroshelia@example.net> Delivered-To: castroshelia@example.net Received: (qmail 3622 invoked from network); 4 Nov 2010 00:31:27 -0000 Received: from unknown (HELO mail.apache.org) (83.161.120.155) by 83.161.120.155 with SMTP; 4 Nov 2010 00:31:27 -0000 Received: (qmail 18266 invoked by uid 500); 4 Nov 2010 00:31:58 -0000 Delivered-To: castroshelia@example.net Received: (qmail 18250 invoked by uid 500); 4 Nov 2010 00:31:58 -0000 Mailing-List: contact castroshelia@example.net; run by ezmlm Precedence: bulk List-Help: <mailto:castroshelia@example.net> List-Unsubscribe: <mailto:castroshelia@example.net> List-Post: <mailto:castroshelia@example.net> List-Id: <commits.shindig.apache.org> Reply-To: castroshelia@example.net Delivered-To: mailing list castroshelia@example.net Received: (qmail 18243 invoked by uid 99); 4 Nov 2010 00:31:58 -0000 Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Nov 2010 00:31:58 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Nov 2010 00:31:56 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id C19AB2388903; Thu, 4 Nov 2010 00:30:42 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1030777 - in /shindig/trunk/java/gadgets/src: main/java/org/apache/shindig/gadgets/servlet/ main/java/org/apache/shindig/gadgets/uri/ test/java/org/apache/shindig/gadgets/servlet/ Date: Thu, 04 Nov 2010 00:30:42 -0000 To: castroshelia@example.net From: castroshelia@example.net X-Mailer: svnmailer-1.0.8 Message-Id: <castroshelia@example.net> Author: zhoresh Date: Thu Nov 4 00:30:42 2010 New Revision: 1030777 URL: http://svn.apache.org/viewvc?rev=1030777&view=rev Log: Ref http://codereview.appspot.com/2851041/ Add proxy request to GadgetHandler Modified: shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/GadgetsHandler.java shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/GadgetsHandlerApi.java shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/GadgetsHandlerService.java shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/uri/ProxyUriBase.java shindig/trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/servlet/GadgetsHandlerServiceTest.java shindig/trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/servlet/GadgetsHandlerTest.java Modified: shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/GadgetsHandler.java URL: http://svn.apache.org/viewvc/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/GadgetsHandler.java?rev=1030777&r1=1030776&r2=1030777&view=diff ============================================================================== --- shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/GadgetsHandler.java (original) +++ shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/GadgetsHandler.java Thu Nov 4 00:30:42 2010 @@ -46,6 +46,7 @@ import java.util.concurrent.CompletionSe import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorCompletionService; import java.util.concurrent.ExecutorService; +import java.util.logging.Logger; import javax.servlet.http.HttpServletResponse; @@ -60,12 +61,18 @@ public class GadgetsHandler { static final String FAILURE_METADATA = "Failed to get gadget metadata."; @VisibleForTesting static final String FAILURE_TOKEN = "Failed to get gadget token."; + @VisibleForTesting + static final String FAILURE_PROXY = "Failed to get proxy data."; private static final List<String> DEFAULT_METADATA_FIELDS = ImmutableList.of("iframeUrl", "userPrefs.*", "modulePrefs.*", "views.*"); private static final List<String> DEFAULT_TOKEN_FIELDS = ImmutableList.of("token"); + private static final List<String> DEFAULT_PROXY_FIELDS = ImmutableList.of("proxyUrl"); + + private static final Logger LOG = Logger.getLogger(GadgetsHandler.class.getName()); + protected final ExecutorService executor; protected final GadgetsHandlerService handlerService; @@ -106,6 +113,18 @@ public class GadgetsHandler { }.execute(request); } + @Operation(httpMethods = {"POST", "GET"}, path = "proxy.get") + public Map<String, GadgetsHandlerApi.BaseResponse> proxy(BaseRequestItem request) + throws ProtocolException { + return new AbstractExecutor() { + @Override + protected Callable<CallableData> createJob(String url, BaseRequestItem request) + throws ProcessingException { + return createProxyJob(url, request); + } + }.execute(request); + } + @Operation(httpMethods = "GET", path = "/@metadata.supportedFields") public Set<String> supportedFields(RequestItem request) { return ImmutableSet.copyOf(beanFilter @@ -118,6 +137,12 @@ public class GadgetsHandler { beanFilter.getBeanFields(GadgetsHandlerApi.TokenResponse.class, 5)); } + @Operation(httpMethods = "GET", path = "/@proxy.supportedFields") + public Set<String> proxySupportedFields(RequestItem request) { + return ImmutableSet.copyOf( + beanFilter.getBeanFields(GadgetsHandlerApi.ProxyResponse.class, 5)); + } + /** * Class to handle threaded reply. * Mainly it made to support filtering the id (url) @@ -214,6 +239,23 @@ public class GadgetsHandler { }; } + // Hook to override in sub-class. + protected Callable<CallableData> createProxyJob(final String url, + BaseRequestItem request) throws ProcessingException { + final ProxyRequestData proxyRequest = new ProxyRequestData(url, request); + return new Callable<CallableData>() { + public CallableData call() throws Exception { + try { + return new CallableData(url, handlerService.getProxy(proxyRequest)); + } catch (Exception e) { + return new CallableData(url, + handlerService.createErrorResponse(null, e, FAILURE_PROXY)); + } + } + }; + } + + /** * Gadget context classes used to translate JSON BaseRequestItem into a more * meaningful model objects that Java can work with. @@ -236,6 +278,29 @@ public class GadgetsHandler { this.fields = processFields(request, defaultFields); } + protected Boolean getBooleanParam(BaseRequestItem request, String field) { + String val = request.getParameter(field); + if (val != null) { + return "1".equals(val) || Boolean.valueOf(val); + } + return false; + } + + protected Integer getIntegerParam(BaseRequestItem request, String field) + throws ProcessingException { + String val = request.getParameter(field); + Integer intVal = null; + if (val != null) { + try { + intVal = Integer.valueOf(val); + } catch (NumberFormatException e) { + throw new ProcessingException("Error parsing " + field + " parameter", + HttpServletResponse.SC_BAD_REQUEST); + } + } + return intVal; + } + public Uri getUrl() { return uri; } @@ -254,6 +319,87 @@ public class GadgetsHandler { } } + protected class ProxyRequestData extends AbstractRequest + implements GadgetsHandlerApi.ProxyRequest { + + private final String gadget; + private final Integer refresh; + private final boolean debug; + private final boolean ignoreCache; + private final String fallbackUrl; + private final String mimetype; + private final boolean sanitize; + private final boolean cajole; + private final GadgetsHandlerApi.ImageParams imageParams; + + public ProxyRequestData(String url, BaseRequestItem request) throws ProcessingException { + super(url, request, DEFAULT_PROXY_FIELDS); + this.ignoreCache = getBooleanParam(request, "ignoreCache"); + this.debug = getBooleanParam(request, "debug"); + this.sanitize = getBooleanParam(request, "sanitize"); + this.cajole = getBooleanParam(request, "cajole"); + this.gadget = request.getParameter("gadget"); + this.fallbackUrl = request.getParameter("fallback_url"); + this.mimetype = request.getParameter("rewriteMime"); + this.refresh = getIntegerParam(request, "refresh"); + imageParams = getImageParams(request); + } + + private GadgetsHandlerApi.ImageParams getImageParams(BaseRequestItem request) + throws ProcessingException { + GadgetsHandlerApi.ImageParams params = null; + Boolean doNotExpand = getBooleanParam(request, "no_expand"); + Integer height = getIntegerParam(request, "resize_h"); + Integer width = getIntegerParam(request, "resize_w"); + Integer quality = getIntegerParam(request, "resize_q"); + + if (height != null || width != null) { + return beanDelegator.createDelegator(null, GadgetsHandlerApi.ImageParams.class, + ImmutableMap.<String, Object>of( + "height", BeanDelegator.nullable(height), + "width", BeanDelegator.nullable(width), + "quality", BeanDelegator.nullable(quality), + "donotexpand", BeanDelegator.nullable(doNotExpand))); + } + return params; + } + + public boolean getDebug() { + return debug; + } + + public String getFallbackUrl() { + return fallbackUrl; + } + + public boolean getIgnoreCahce() { + return ignoreCache; + } + + public GadgetsHandlerApi.ImageParams getImageParams() { + return imageParams; + } + + public Integer getRefresh() { + return refresh; + } + + public String getRewriteMimeType() { + return mimetype; + } + + public boolean getSanitize() { + return sanitize; + } + + public boolean getCajole() { + return cajole; + } + + public String getGadget() { + return gadget; + } + } protected class TokenRequestData extends AbstractRequest implements GadgetsHandlerApi.TokenRequest { @@ -284,8 +430,8 @@ public class GadgetsHandler { this.locale = (lang != null && country != null) ? new Locale(lang, country) : (lang != null) ? new Locale(lang) : GadgetSpec.DEFAULT_LOCALE; - this.ignoreCache = Boolean.valueOf(request.getParameter("ignoreCache")); - this.debug = Boolean.valueOf(request.getParameter("debug")); + this.ignoreCache = getBooleanParam(request, "ignoreCache"); + this.debug = getBooleanParam(request, "debug"); } public int getModuleId() { Modified: shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/GadgetsHandlerApi.java URL: http://svn.apache.org/viewvc/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/GadgetsHandlerApi.java?rev=1030777&r1=1030776&r2=1030777&view=diff ============================================================================== --- shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/GadgetsHandlerApi.java (original) +++ shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/GadgetsHandlerApi.java Thu Nov 4 00:30:42 2010 @@ -54,8 +54,10 @@ public class GadgetsHandlerApi { @Unfiltered public Error getError(); /** The response expiration time (miliseconds since epoch), -1 for no caching */ + @Unfiltered public Long getExpireTimeMs(); /** The response time (miliseconds since epoch) - usefull for misconfigured client time */ + @Unfiltered public Long getResponseTimeMs(); } @@ -100,10 +102,8 @@ public class GadgetsHandlerApi { public Uri getHref(); public boolean getQuirks(); public String getContent(); - public int getPreferredHeight(); - public int getPreferredWidth(); - public boolean needsUserPrefSubstitution(); - public Map<String, String> getAttributes(); + public int getPreferredHeight(); // Default to 0 + public int getPreferredWidth(); // Default to 0 } public enum UserPrefDataType { @@ -116,7 +116,6 @@ public class GadgetsHandlerApi { public String getDefaultValue(); public boolean getRequired(); public UserPrefDataType getDataType(); - public Map<String, String> getEnumValues(); public List<EnumValuePair> getOrderedEnumValues(); } @@ -172,4 +171,50 @@ public class GadgetsHandlerApi { public interface TokenResponse extends BaseResponse { public String getToken(); } + + public interface ProxyRequest extends BaseRequest { + // The BaseRequest.url store the resource to proxy + public String getGadget(); + public Integer getRefresh(); + public boolean getDebug(); + public boolean getIgnoreCahce(); + public String getFallbackUrl(); + public String getRewriteMimeType(); + public boolean getSanitize(); + public boolean getCajole(); + public ImageParams getImageParams(); + } + + public interface ImageParams { + public Integer getHeight(); + public Integer getWidth(); + public Integer getQuality(); + public Boolean getDoNotExpand(); + } + + public interface ProxyResponse extends BaseResponse { + public Uri getProxyUrl(); + public HttpResponse getProxyContent(); + } + + public interface HttpResponse { + public int getCode(); + public String getEncoding(); + public String getContentBase64(); + public List<NameValuePair> getHeaders(); + } + + public interface NameValuePair { + public String getName(); + public String getValue(); + } + + public interface JsRequest extends BaseRequest { + public List<String> getFeatures(); + public boolean getForContainer(); + } + + public interface JsResponse extends BaseResponse { + public Uri getJsUrl(); + } } Modified: shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/GadgetsHandlerService.java URL: http://svn.apache.org/viewvc/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/GadgetsHandlerService.java?rev=1030777&r1=1030776&r2=1030777&view=diff ============================================================================== --- shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/GadgetsHandlerService.java (original) +++ shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/GadgetsHandlerService.java Thu Nov 4 00:30:42 2010 @@ -19,10 +19,13 @@ package org.apache.shindig.gadgets.servlet; import com.google.common.annotations.VisibleForTesting; +import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.inject.Inject; import com.google.inject.name.Named; +import org.apache.commons.codec.binary.Base64InputStream; +import org.apache.commons.io.IOUtils; import org.apache.shindig.auth.SecurityToken; import org.apache.shindig.auth.SecurityTokenCodec; import org.apache.shindig.auth.SecurityTokenException; @@ -30,6 +33,7 @@ import org.apache.shindig.common.uri.Uri import org.apache.shindig.common.util.TimeSource; import org.apache.shindig.gadgets.Gadget; import org.apache.shindig.gadgets.GadgetContext; +import org.apache.shindig.gadgets.GadgetException; import org.apache.shindig.gadgets.RenderingContext; import org.apache.shindig.gadgets.http.HttpResponse; import org.apache.shindig.gadgets.process.ProcessingException; @@ -42,12 +46,19 @@ import org.apache.shindig.gadgets.spec.U import org.apache.shindig.gadgets.spec.View; import org.apache.shindig.gadgets.spec.UserPref.EnumValuePair; import org.apache.shindig.gadgets.uri.IframeUriManager; +import org.apache.shindig.gadgets.uri.JsUriManager; +import org.apache.shindig.gadgets.uri.ProxyUriManager; +import org.apache.shindig.gadgets.uri.ProxyUriManager.ProxyUri; import org.apache.shindig.protocol.conversion.BeanDelegator; import org.apache.shindig.protocol.conversion.BeanFilter; +import java.io.IOException; +import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Set; +import java.util.logging.Level; +import java.util.logging.Logger; import javax.servlet.http.HttpServletResponse; @@ -60,6 +71,8 @@ public class GadgetsHandlerService { private static final Locale DEFAULT_LOCALE = new Locale("all", "all"); + private static final Logger LOG = Logger.getLogger(GadgetsHandler.class.getName()); + // Map shindig data class to API interfaces @VisibleForTesting static final Map<Class<?>, Class<?>> apiClasses = @@ -91,6 +104,9 @@ public class GadgetsHandlerService { protected final Processor processor; protected final IframeUriManager iframeUriManager; protected final SecurityTokenCodec securityTokenCodec; + protected final ProxyUriManager proxyUriManager; + protected final JsUriManager jsUriManager; + protected final ProxyHandler proxyHandler; protected final BeanDelegator beanDelegator; protected final long specRefreshInterval; protected final BeanFilter beanFilter; @@ -98,12 +114,16 @@ public class GadgetsHandlerService { @Inject public GadgetsHandlerService(TimeSource timeSource, Processor processor, IframeUriManager iframeUriManager, SecurityTokenCodec securityTokenCodec, + ProxyUriManager proxyUriManager, JsUriManager jsUriManager, ProxyHandler proxyHandler, @Named("shindig.cache.xml.refreshInterval") long specRefreshInterval, BeanFilter beanFilter) { this.timeSource = timeSource; this.processor = processor; this.iframeUriManager = iframeUriManager; this.securityTokenCodec = securityTokenCodec; + this.proxyUriManager = proxyUriManager; + this.jsUriManager = jsUriManager; + this.proxyHandler = proxyHandler; this.specRefreshInterval = specRefreshInterval; this.beanFilter = beanFilter; @@ -170,6 +190,57 @@ public class GadgetsHandlerService { return createTokenResponse(request.getUrl(), token, fields, expiryTimeMs); } + public GadgetsHandlerApi.ProxyResponse getProxy(GadgetsHandlerApi.ProxyRequest request) + throws ProcessingException { + if (request.getContainer() == null) { + throw new ProcessingException("Missing container paramater", HttpResponse.SC_BAD_REQUEST); + } + if (request.getUrl() == null) {
{'source': 'Apache Software Foundation Public Mail Archives'}