Modified: shindig/branches/2.0.x/php/src/gadgets/sample/BasicGadgetSpecFactory.php URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/php/src/gadgets/sample/BasicGadgetSpecFactory.php?rev=983934&r1=983933&r2=983934&view=diff ============================================================================== --- shindig/branches/2.0.x/php/src/gadgets/sample/BasicGadgetSpecFactory.php (original) +++ shindig/branches/2.0.x/php/src/gadgets/sample/BasicGadgetSpecFactory.php Tue Aug 10 11:32:26 2010 @@ -23,8 +23,10 @@ */ class BasicGadgetSpecFactory { private $cache; + private $context; public function getGadgetSpec(GadgetContext $context) { + $this->context = $context; return $this->getGadgetSpecUri($context->getUrl(), $context->getIgnoreCache()); } @@ -44,10 +46,10 @@ class BasicGadgetSpecFactory { $remoteContentRequest->getOptions()->ignoreCache = $ignoreCache; $remoteContent = new BasicRemoteContent(); $spec = $remoteContent->fetch($remoteContentRequest); - - $gadgetSpecParser = new GadgetSpecParser(); - $gadgetSpec = $gadgetSpecParser->parse($spec->getResponseContent()); + + $gadgetSpecParserClass = Config::get('gadget_spec_parser'); + $gadgetSpecParser = new $gadgetSpecParserClass(); + $gadgetSpec = $gadgetSpecParser->parse($spec->getResponseContent(), $this->context); return $gadgetSpec; } - }
Modified: shindig/branches/2.0.x/php/src/gadgets/servlet/GadgetRenderingServlet.php URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/php/src/gadgets/servlet/GadgetRenderingServlet.php?rev=983934&r1=983933&r2=983934&view=diff ============================================================================== --- shindig/branches/2.0.x/php/src/gadgets/servlet/GadgetRenderingServlet.php (original) +++ shindig/branches/2.0.x/php/src/gadgets/servlet/GadgetRenderingServlet.php Tue Aug 10 11:32:26 2010 @@ -40,14 +40,15 @@ require_once 'src/gadgets/rewrite/Gadget require_once 'src/gadgets/rewrite/DomRewriter.php'; class GadgetRenderingServlet extends HttpServlet { - private $context; + protected $context; public function doGet() { try { if (empty($_GET['url'])) { throw new GadgetException("Missing required parameter: url"); } - $this->context = new GadgetContext('GADGET'); + $contextClass = Config::get('gadget_context_class'); + $this->context = new $contextClass('GADGET'); $gadgetSigner = Config::get('security_token_signer'); $gadgetSigner = new $gadgetSigner(); try { @@ -60,7 +61,8 @@ class GadgetRenderingServlet extends Htt $token = ''; } } - $gadgetSpecFactory = new GadgetFactory($this->context, $token); + $factoryClass = Config::get('gadget_factory_class'); + $gadgetSpecFactory = new $factoryClass($this->context, $token); $gadget = $gadgetSpecFactory->createGadget(); $this->setCachingHeaders(); $this->renderGadget($gadget); @@ -69,7 +71,7 @@ class GadgetRenderingServlet extends Htt } } - private function renderGadget(Gadget $gadget) { + protected function renderGadget(Gadget $gadget) { $view = $gadget->getView($this->context->getView()); if ($view['type'] == 'URL') { require_once "src/gadgets/render/GadgetUrlRenderer.php"; @@ -86,7 +88,7 @@ class GadgetRenderingServlet extends Htt $gadgetRenderer->renderGadget($gadget, $view); } - private function setCachingHeaders() { + protected function setCachingHeaders() { $this->setContentType("text/html; charset=UTF-8"); if ($this->context->getIgnoreCache()) { // no cache was requested, set non-caching-headers @@ -100,7 +102,7 @@ class GadgetRenderingServlet extends Htt } } - private function showError($e) { + protected function showError($e) { header("HTTP/1.0 400 Bad Request", true, 400); echo "<html><body>"; echo "<h1>Error</h1>"; Modified: shindig/branches/2.0.x/php/src/gadgets/servlet/JsServlet.php URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/php/src/gadgets/servlet/JsServlet.php?rev=983934&r1=983933&r2=983934&view=diff ============================================================================== --- shindig/branches/2.0.x/php/src/gadgets/servlet/JsServlet.php (original) +++ shindig/branches/2.0.x/php/src/gadgets/servlet/JsServlet.php Tue Aug 10 11:32:26 2010 @@ -54,7 +54,8 @@ class JsServlet extends HttpServlet { } $found = array(); $missing = array(); - $context = new GadgetContext('GADGET'); + $contextClass = Config::get('gadget_context_class'); + $context = new $contextClass('GADGET'); $registry = new GadgetFeatureRegistry(Config::get('features_path')); if ($registry->resolveFeatures($needed, $found, $missing)) { $isGadgetContext = !isset($_GET["c"]) || $_GET['c'] == 0 ? true : false; Modified: shindig/branches/2.0.x/php/src/gadgets/servlet/MakeRequestServlet.php URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/php/src/gadgets/servlet/MakeRequestServlet.php?rev=983934&r1=983933&r2=983934&view=diff ============================================================================== --- shindig/branches/2.0.x/php/src/gadgets/servlet/MakeRequestServlet.php (original) +++ shindig/branches/2.0.x/php/src/gadgets/servlet/MakeRequestServlet.php Tue Aug 10 11:32:26 2010 @@ -34,7 +34,8 @@ class MakeRequestServlet extends HttpSer public function doGet() { try { $this->noHeaders = true; - $context = new GadgetContext('GADGET'); + $contextClass = Config::get('gadget_context_class'); + $context = new $contextClass('GADGET'); $makeRequestParams = MakeRequestOptions::fromCurrentRequest(); $makeRequestHandler = new MakeRequestHandler($context); $makeRequestHandler->fetchJson($makeRequestParams); Modified: shindig/branches/2.0.x/php/src/gadgets/servlet/ProxyServlet.php URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/php/src/gadgets/servlet/ProxyServlet.php?rev=983934&r1=983933&r2=983934&view=diff ============================================================================== --- shindig/branches/2.0.x/php/src/gadgets/servlet/ProxyServlet.php (original) +++ shindig/branches/2.0.x/php/src/gadgets/servlet/ProxyServlet.php Tue Aug 10 11:32:26 2010 @@ -33,14 +33,16 @@ class ProxyServlet extends HttpServlet { try { // Make sure the HttpServlet doesn't overwrite our headers $this->noHeaders = true; - $context = new GadgetContext('GADGET'); + $contextClass = Config::get('gadget_context_class'); + $context = new $contextClass('GADGET'); $url = (isset($_GET['url']) ? $_GET['url'] : (isset($_POST['url']) ? $_POST['url'] : false)); $url = urldecode($url); if (! $url) { header("HTTP/1.0 400 Bad Request", true); echo "<html><body><h1>400 - Missing url parameter</h1></body></html>"; } - $proxyHandler = new ProxyHandler($context); + $proxyHandlerClass = Config::get('proxy_handler'); + $proxyHandler = new $proxyHandlerClass($context); $proxyHandler->fetch($url); } catch (Exception $e) { // catch all exceptions and give a 500 server error Modified: shindig/branches/2.0.x/php/src/gadgets/templates/DataPipelining.php URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/php/src/gadgets/templates/DataPipelining.php?rev=983934&r1=983933&r2=983934&view=diff ============================================================================== --- shindig/branches/2.0.x/php/src/gadgets/templates/DataPipelining.php (original) +++ shindig/branches/2.0.x/php/src/gadgets/templates/DataPipelining.php Tue Aug 10 11:32:26 2010 @@ -136,8 +136,8 @@ class DataPipelining { /** * Peforms the actual http fetching of the data-pipelining requests, all social requests - * are made to $_SERVER['SERVER_NAME'] (the virtual host name of this server) / (optional) web_prefix / social / rpc, and - * the httpRequest's are made to $_SERVER['SERVER_NAME'] (the virtual host name of this server) / (optional) web_prefix / gadgets / makeRequest + * are made to $_SERVER['HTTP_HOST'] (the virtual host name of this server) / (optional) web_prefix / social / rpc, and + * the httpRequest's are made to $_SERVER['HTTP_HOST'] (the virtual host name of this server) / (optional) web_prefix / gadgets / makeRequest * both request types use the current security token ($_GET['st']) when performing the requests so they happen in the correct context * * @param array $requests @@ -180,7 +180,7 @@ class DataPipelining { } if (count($jsonRequests)) { // perform social api requests - $request = new RemoteContentRequest('http://'.$_SERVER['SERVER_NAME'] . Config::get('web_prefix') . '/social/rpc?st=' . urlencode($securityToken) . '&format=json', "Content-Type: application/json\n", json_encode($jsonRequests)); + $request = new RemoteContentRequest('http://'.$_SERVER['HTTP_HOST'] . Config::get('web_prefix') . '/social/rpc?st=' . urlencode($securityToken) . '&format=json', "Content-Type: application/json\n", json_encode($jsonRequests)); $request->setMethod('POST'); $remoteFetcherClass = Config::get('remote_content_fetcher'); $remoteFetcher = new $remoteFetcherClass(); @@ -191,7 +191,7 @@ class DataPipelining { if (count($httpRequests)) { $requestQueue = array(); foreach ($httpRequests as $request) { - $req = new RemoteContentRequest($_SERVER['SERVER_NAME'] . Config::get('web_prefix') . '/gadgets/makeRequest?url=' . urlencode($request['url']) . '&st=' . urlencode($securityToken) . (! empty($request['queryStr']) ? '&' . $request['queryStr'] : '')); + $req = new RemoteContentRequest($_SERVER['HTTP_HOST'] . Config::get('web_prefix') . '/gadgets/makeRequest?url=' . urlencode($request['url']) . '&st=' . urlencode($securityToken) . (! empty($request['queryStr']) ? '&' . $request['queryStr'] : '')); $req->getOptions()->ignoreCache = $context->getIgnoreCache(); $req->setNotSignedUri($request['url']); $requestQueue[] = $req; Modified: shindig/branches/2.0.x/php/src/gadgets/templates/TemplateLibrary.php URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/php/src/gadgets/templates/TemplateLibrary.php?rev=983934&r1=983933&r2=983934&view=diff ============================================================================== --- shindig/branches/2.0.x/php/src/gadgets/templates/TemplateLibrary.php (original) +++ shindig/branches/2.0.x/php/src/gadgets/templates/TemplateLibrary.php Tue Aug 10 11:32:26 2010 @@ -247,7 +247,7 @@ class TemplateLibraryEntry { * @param unknown_type $style */ public function addStyle(TemplateLibraryContent $style) { - $this->style[] = new TemplateLibraryContent($style); + $this->style[] = $style; } /** Modified: shindig/branches/2.0.x/php/src/gadgets/templates/TemplateParser.php URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/php/src/gadgets/templates/TemplateParser.php?rev=983934&r1=983933&r2=983934&view=diff ============================================================================== --- shindig/branches/2.0.x/php/src/gadgets/templates/TemplateParser.php (original) +++ shindig/branches/2.0.x/php/src/gadgets/templates/TemplateParser.php Tue Aug 10 11:32:26 2010 @@ -138,6 +138,7 @@ class TemplateParser { if (isset($childNode->tagName) && ! empty($childNode->tagName)) { $nodeParam = ($pos = strpos($childNode->tagName, ':')) ? trim(substr($childNode->tagName, $pos + 1)) : trim($childNode->tagName); $this->dataContext['_os_render_nodes'][$nodeParam] = $childNode; + $myContext[$nodeParam] = $this->nodeAttributesToScope($childNode); } } } @@ -154,7 +155,6 @@ class TemplateParser { $importedNode = $ownerDocument->importNode($childNode, true); $importedNode = $node->parentNode->insertBefore($importedNode, $node); } - $node->parentNode->removeChild($node); } } @@ -286,6 +286,7 @@ class TemplateParser { } } } + // if a repeat attribute was found, don't recurse on it's child nodes, the repeat handling already did that if (isset($node->childNodes) && $node->childNodes->length > 0) { $removeNodes = array(); @@ -392,14 +393,17 @@ class TemplateParser { case 'os:name': $this->parseLibrary('os:Name', $node); + return $node; break; case 'os:badge': $this->parseLibrary('os:Badge', $node); + return $node; break; case 'os:peopleselector': $this->parseLibrary('os:PeopleSelector', $node); + return $node; break; case 'os:html': Modified: shindig/branches/2.0.x/php/src/social/service/DataRequestHandler.php URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/php/src/social/service/DataRequestHandler.php?rev=983934&r1=983933&r2=983934&view=diff ============================================================================== --- shindig/branches/2.0.x/php/src/social/service/DataRequestHandler.php (original) +++ shindig/branches/2.0.x/php/src/social/service/DataRequestHandler.php Tue Aug 10 11:32:26 2010 @@ -92,7 +92,8 @@ abstract class DataRequestHandler { * @param parameters url parameters to get request type(people/activity) */ public function getSupportedFields($parameters) { - $context = new GadgetContext('GADGET'); + $contextClass = Config::get('gadget_context_class'); + $context = new $contextClass('GADGET'); $container = $context->getContainer(); $containerConfig = new ContainerConfig(Config::get('container_path')); $config = $containerConfig->getConfig($container, 'gadgets.features'); Modified: shindig/branches/2.0.x/php/src/social/service/HttpHandler.php URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/php/src/social/service/HttpHandler.php?rev=983934&r1=983933&r2=983934&view=diff ============================================================================== --- shindig/branches/2.0.x/php/src/social/service/HttpHandler.php (original) +++ shindig/branches/2.0.x/php/src/social/service/HttpHandler.php Tue Aug 10 11:32:26 2010 @@ -49,7 +49,8 @@ class HttpHandler extends DataRequestHan // complain. $options = MakeRequestOptions::fromRpcRequestItem($requestItem); $makeRequest = new MakeRequest(); - $context = new GadgetContext('GADGET'); + $contextClass = Config::get('gadget_context_class'); + $context = new $contextClass('GADGET'); $response = $makeRequest->fetch($context, $options); $result = array( Modified: shindig/branches/2.0.x/php/src/social/service/MediaItemHandler.php URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/php/src/social/service/MediaItemHandler.php?rev=983934&r1=983933&r2=983934&view=diff ============================================================================== --- shindig/branches/2.0.x/php/src/social/service/MediaItemHandler.php (original) +++ shindig/branches/2.0.x/php/src/social/service/MediaItemHandler.php Tue Aug 10 11:32:26 2010 @@ -126,7 +126,8 @@ class MediaItemHandler extends DataReque throw new SocialSpiException("The content type " . $response->getContentType() . " fetched from $uri is not valid.", ResponseError::$BAD_REQUEST); } - return $this->writeBinaryContent($response->getResponseContent(), $response->getContentType()); + $content = $response->getResponseContent(); + return $this->writeBinaryContent($content, $response->getContentType()); } /** @@ -159,7 +160,8 @@ class MediaItemHandler extends DataReque } else if (isset($GLOBALS['HTTP_RAW_POST_DATA'])) { // The REST api supports to post the file using the content type 'image/*', 'video/*' or 'audio/*'. if ($this->isValidContentType($_SERVER['CONTENT_TYPE'])) { - $file = $this->writeBinaryContent($GLOBALS['HTTP_RAW_POST_DATA'], $_SERVER['CONTENT_TYPE']); + $postData = $GLOBALS['HTTP_RAW_POST_DATA']; + $file = $this->writeBinaryContent($postData, $_SERVER['CONTENT_TYPE']); } } return $file; Modified: shindig/branches/2.0.x/php/src/social/service/PersonHandler.php URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/php/src/social/service/PersonHandler.php?rev=983934&r1=983933&r2=983934&view=diff ============================================================================== --- shindig/branches/2.0.x/php/src/social/service/PersonHandler.php (original) +++ shindig/branches/2.0.x/php/src/social/service/PersonHandler.php Tue Aug 10 11:32:26 2010 @@ -20,11 +20,11 @@ class PersonHandler extends DataRequestHandler { - private static $PEOPLE_PATH = "/people/{userId}/{groupId}/{personId}"; - private static $DEFAULT_FIELDS = array('id', 'displayName', 'gender', 'thumbnailUrl'); + protected static $PEOPLE_PATH = "/people/{userId}/{groupId}/{personId}"; + protected static $DEFAULT_FIELDS = array('id', 'displayName', 'gender', 'thumbnailUrl'); - private static $ANONYMOUS_ID_TYPE = array('viewer', 'me'); - private static $ANONYMOUS_VIEWER = array( + protected static $ANONYMOUS_ID_TYPE = array('viewer', 'me'); + protected static $ANONYMOUS_VIEWER = array( 'isOwner' => false, 'isViewer' => true, 'name' => 'anonymous_user', Modified: shindig/branches/2.0.x/php/src/social/service/RequestItem.php URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/php/src/social/service/RequestItem.php?rev=983934&r1=983933&r2=983934&view=diff ============================================================================== --- shindig/branches/2.0.x/php/src/social/service/RequestItem.php (original) +++ shindig/branches/2.0.x/php/src/social/service/RequestItem.php Tue Aug 10 11:32:26 2010 @@ -129,7 +129,7 @@ abstract class RequestItem { } elseif ($sortOrder == CollectionOptions::SORT_ORDER_ASCENDING || $sortOrder == CollectionOptions::SORT_ORDER_DESCENDING) { return $sortOrder; } else { - throw new SocialSpiException("Parameter " . sef::$SORT_ORDER . " (" . $sortOrder . ") is not valid.", ResponseError::$BAD_REQUEST); + throw new SocialSpiException("Parameter " . self::$SORT_ORDER . " (" . $sortOrder . ") is not valid.", ResponseError::$BAD_REQUEST); } } Modified: shindig/branches/2.0.x/php/src/social/servlet/ApiServlet.php URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/php/src/social/servlet/ApiServlet.php?rev=983934&r1=983933&r2=983934&view=diff ============================================================================== --- shindig/branches/2.0.x/php/src/social/servlet/ApiServlet.php (original) +++ shindig/branches/2.0.x/php/src/social/servlet/ApiServlet.php Tue Aug 10 11:32:26 2010 @@ -131,9 +131,6 @@ abstract class ApiServlet extends HttpSe return null; } } - if (count(explode(':', $token)) < 7) { - $token = urldecode(base64_decode($token)); - } $gadgetSigner = Config::get('security_token_signer'); $gadgetSigner = new $gadgetSigner(); return $gadgetSigner->createToken($token); Modified: shindig/branches/2.0.x/pom.xml URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/pom.xml?rev=983934&r1=983933&r2=983934&view=diff ============================================================================== --- shindig/branches/2.0.x/pom.xml (original) +++ shindig/branches/2.0.x/pom.xml Tue Aug 10 11:32:26 2010 @@ -95,7 +95,7 @@ </otherArchives> </mailingList> <mailingList> - <name>Shindig User List</name> + <name>Shindig Users List</name> <subscribe>[email protected]</subscribe> <unsubscribe>[email protected]</unsubscribe> <archive>http://mail-archives.apache.org/mod_mbox/shindig-users/</archive> @@ -312,6 +312,15 @@ </roles> </developer> <developer> + <id>hsaputra</id> + <name>Henry Saputra</name> + <email>[email protected]</email> + <organization>ASF</organization> + <roles> + <role>PMC Member</role> + </roles> + </developer> + <developer> <id>chaowang</id> <name>Jacky Wang</name> <email>[email protected]</email> @@ -1088,7 +1097,7 @@ <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>maven-jetty-plugin</artifactId> - <version>6.1.22</version> + <version>6.1.24</version> </plugin> <plugin> <groupId>org.apache.geronimo.genesis.plugins</groupId> @@ -1355,6 +1364,13 @@ </dependency> <!-- external dependencies --> + <dependency> + <groupId>com.google.code.findbugs</groupId> + <artifactId>jsr305</artifactId> + <version>1.3.9</version> + <!-- cannot be provided scope, guice uses @Nullable at runtime --> + </dependency> + <dependency> <groupId>com.google.inject</groupId> <artifactId>guice</artifactId> @@ -1374,14 +1390,15 @@ </dependency> <dependency> - <groupId>com.google.collections</groupId> - <artifactId>google-collections</artifactId> - <version>1.0</version> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + <version>r06</version> </dependency> + <dependency> <groupId>commons-codec</groupId> <artifactId>commons-codec</artifactId> - <version>1.3</version> + <version>1.4</version> </dependency> <dependency> <groupId>commons-fileupload</groupId> @@ -1396,21 +1413,16 @@ <dependency> <groupId>caja</groupId> <artifactId>htmlparser</artifactId> - <version>r4135</version> + <version>r4209</version> <scope>compile</scope> </dependency> <dependency> <groupId>caja</groupId> <artifactId>caja</artifactId> - <version>r4135</version> + <version>r4209</version> <scope>compile</scope> </dependency> <dependency> - <groupId>com.googlecode.json-simple</groupId> - <artifactId>json-simple</artifactId> - <version>1.1</version> - </dependency> - <dependency> <groupId>net.oauth.core</groupId> <artifactId>oauth</artifactId> <version>20100527</version> @@ -1507,12 +1519,6 @@ <version>1.6.2</version> </dependency> <dependency> - <groupId>findbugs</groupId> - <artifactId>annotations</artifactId> - <version>1.0.0</version> - <scope>provided</scope> - </dependency> - <dependency> <groupId>com.thoughtworks.xstream</groupId> <artifactId>xstream</artifactId> <version>1.3.1</version> @@ -1543,14 +1549,25 @@ <version>0.97-incubator</version> </dependency> <dependency> - <groupId>de.odysseus.juel</groupId> - <artifactId>juel-api</artifactId> - <version>2.1.3</version> + <groupId>org.apache.tomcat</groupId> + <artifactId>el-api</artifactId> + <version>6.0.26</version> + </dependency> + <dependency> + <groupId>org.apache.tomcat</groupId> + <artifactId>jasper-el</artifactId> + <version>6.0.26</version> </dependency> <dependency> <groupId>de.odysseus.juel</groupId> <artifactId>juel-impl</artifactId> <version>2.1.3</version> + <exclusions> + <exclusion> + <groupId>de.odysseus.juel</groupId> + <artifactId>juel-api</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>net.sf.ezmorph</groupId>
