You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shindig.apache.org by ch...@apache.org on 2009/08/05 11:56:03 UTC
svn commit: r801115 - in /incubator/shindig/trunk/php: config/ src/gadgets/
src/gadgets/oauth/ src/gadgets/render/ src/gadgets/servlet/
src/gadgets/templates/
Author: chabotc
Date: Wed Aug 5 09:56:03 2009
New Revision: 801115
URL: http://svn.apache.org/viewvc?rev=801115&view=rev
Log:
SHINDIG-1141 by Arne Roomann-Kurrik - Make BasicRemoteContentFetcher configurable. Some hard coded references to the basic remote content fetcher snuk in in the last months, this patch corrects that
Modified:
incubator/shindig/trunk/php/config/container.php
incubator/shindig/trunk/php/src/gadgets/GadgetFactory.php
incubator/shindig/trunk/php/src/gadgets/oauth/OAuthFetcher.php
incubator/shindig/trunk/php/src/gadgets/render/GadgetHrefRenderer.php
incubator/shindig/trunk/php/src/gadgets/servlet/GadgetRenderingServlet.php
incubator/shindig/trunk/php/src/gadgets/servlet/MetadataServlet.php
incubator/shindig/trunk/php/src/gadgets/templates/DataPipelining.php
Modified: incubator/shindig/trunk/php/config/container.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/config/container.php?rev=801115&r1=801114&r2=801115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/config/container.php (original)
+++ incubator/shindig/trunk/php/config/container.php Wed Aug 5 09:56:03 2009
@@ -119,6 +119,7 @@
// Configurable classes. Change these to the class name to use, and make sure the auto-loader can find them
'blacklist_class' => 'BasicGadgetBlacklist',
'remote_content' => 'BasicRemoteContent',
+ 'remote_content_fetcher' => 'BasicRemoteContentFetcher',
'security_token_signer' => 'BasicSecurityTokenDecoder',
'security_token' => 'BasicSecurityToken',
'oauth_lookup_service' => 'BasicOAuthLookupService',
Modified: incubator/shindig/trunk/php/src/gadgets/GadgetFactory.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/GadgetFactory.php?rev=801115&r1=801114&r2=801115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/GadgetFactory.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/GadgetFactory.php Wed Aug 5 09:56:03 2009
@@ -259,7 +259,9 @@
// Perform the signed requests
if (count($signedRequests)) {
$signingFetcherFactory = new SigningFetcherFactory(Config::get("private_key_file"));
- $remoteContent = new BasicRemoteContent(new BasicRemoteContentFetcher(), $signingFetcherFactory);
+ $remoteFetcherClass = Config::get('remote_content_fetcher');
+ $remoteFetcher = new $remoteFetcherClass();
+ $remoteContent = new BasicRemoteContent($remoteFetcher, $signingFetcherFactory);
$resps = $remoteContent->multiFetch($signedRequests);
foreach ($resps as $response) {
$responses[$response->getNotSignedUrl()] = array(
Modified: incubator/shindig/trunk/php/src/gadgets/oauth/OAuthFetcher.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/oauth/OAuthFetcher.php?rev=801115&r1=801114&r2=801115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/oauth/OAuthFetcher.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/oauth/OAuthFetcher.php Wed Aug 5 09:56:03 2009
@@ -422,7 +422,9 @@
private function sendOAuthMessage(OAuthRequest $request) {
$rcr = $this->createRemoteContentRequest($this->filterOAuthParams($request), $request->get_normalized_http_method(), $request->get_url(), null, RemoteContentRequest::$DEFAULT_CONTENT_TYPE, null, RemoteContentRequest::getDefaultOptions());
$rcr->setToken($this->authToken);
- $fetcher = new BasicRemoteContentFetcher();
+
+ $remoteFetcherClass = Config::get('remote_content_fetcher');
+ $fetcher = new $remoteFetcherClass();
$content = $fetcher->fetchRequest($rcr);
$reply = OAuthRequest::from_request();
$params = OAuthUtil::decodeForm($content->getResponseContent());
@@ -534,7 +536,8 @@
$oauthRequest = $this->newRequestMessageMethod($method, $this->realRequest->getUrl(), $msgParams);
$rcr = $this->createRemoteContentRequest($this->filterOAuthParams($oauthRequest), $this->realRequest->getMethod(), $this->realRequest->getUrl(), $this->realRequest->getHeaders(), $this->realRequest->getContentType(), $this->realRequest->getPostBody(), $this->realRequest->getOptions());
//TODO is there a better way to detect an SP error?
- $fetcher = new BasicRemoteContentFetcher();
+ $remoteFetcherClass = Config::get('remote_content_fetcher');
+ $fetcher = new $remoteFetcherClass();
$content = $fetcher->fetchRequest($rcr);
$statusCode = $content->getHttpCode();
if ($statusCode >= 400 && $statusCode < 500) {
Modified: incubator/shindig/trunk/php/src/gadgets/render/GadgetHrefRenderer.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/render/GadgetHrefRenderer.php?rev=801115&r1=801114&r2=801115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/render/GadgetHrefRenderer.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/render/GadgetHrefRenderer.php Wed Aug 5 09:56:03 2009
@@ -84,8 +84,9 @@
$request->getOptions()->viewerSigned = $this->getSignViewer($view);
$signingFetcherFactory = new SigningFetcherFactory(Config::get("private_key_file"));
}
- $basicFetcher = new BasicRemoteContentFetcher();
- $basicRemoteContent = new BasicRemoteContent($basicFetcher, $signingFetcherFactory, $gadgetSigner);
+ $remoteFetcherClass = Config::get('remote_content_fetcher');
+ $remoteFetcher = new $remoteFetcherClass();
+ $basicRemoteContent = new BasicRemoteContent($remoteFetcher, $signingFetcherFactory, $gadgetSigner);
// Cache POST's as if they were GET's, since we don't want to re-fetch and repost the social data for each view
$basicRemoteContent->setCachePostRequest(true);
if (($response = $basicRemoteContent->getCachedRequest($request)) == false) {
Modified: incubator/shindig/trunk/php/src/gadgets/servlet/GadgetRenderingServlet.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/servlet/GadgetRenderingServlet.php?rev=801115&r1=801114&r2=801115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/servlet/GadgetRenderingServlet.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/servlet/GadgetRenderingServlet.php Wed Aug 5 09:56:03 2009
@@ -27,8 +27,6 @@
require_once 'src/common/RemoteContent.php';
require_once 'src/common/Cache.php';
require_once 'src/common/RemoteContentFetcher.php';
-require_once 'src/common/sample/BasicRemoteContent.php';
-require_once 'src/common/sample/BasicRemoteContentFetcher.php';
require_once 'src/gadgets/GadgetSpecParser.php';
require_once 'src/gadgets/GadgetBlacklist.php';
require_once 'src/gadgets/sample/BasicGadgetBlacklist.php';
Modified: incubator/shindig/trunk/php/src/gadgets/servlet/MetadataServlet.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/servlet/MetadataServlet.php?rev=801115&r1=801114&r2=801115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/servlet/MetadataServlet.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/servlet/MetadataServlet.php Wed Aug 5 09:56:03 2009
@@ -27,8 +27,6 @@
require_once 'src/common/RemoteContent.php';
require_once 'src/common/Cache.php';
require_once 'src/common/RemoteContentFetcher.php';
-require_once 'src/common/sample/BasicRemoteContent.php';
-require_once 'src/common/sample/BasicRemoteContentFetcher.php';
require_once 'src/gadgets/GadgetSpecParser.php';
require_once 'src/gadgets/GadgetBlacklist.php';
require_once 'src/gadgets/sample/BasicGadgetBlacklist.php';
Modified: incubator/shindig/trunk/php/src/gadgets/templates/DataPipelining.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/templates/DataPipelining.php?rev=801115&r1=801114&r2=801115&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/templates/DataPipelining.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/templates/DataPipelining.php Wed Aug 5 09:56:03 2009
@@ -182,8 +182,9 @@
// 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->setMethod('POST');
- $basicFetcher = new BasicRemoteContentFetcher();
- $basicRemoteContent = new BasicRemoteContent($basicFetcher);
+ $remoteFetcherClass = Config::get('remote_content_fetcher');
+ $remoteFetcher = new $remoteFetcherClass();
+ $basicRemoteContent = new BasicRemoteContent($remoteFetcher);
$response = $basicRemoteContent->fetch($request);
$decodedResponse = json_decode($response->getResponseContent(), true);
}