You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by et...@apache.org on 2008/05/28 09:20:29 UTC

svn commit: r660842 - in /incubator/shindig/trunk/java/social-api/src: main/java/org/apache/shindig/social/abdera/AbstractSocialEntityCollectionAdapter.java test/java/org/apache/shindig/social/abdera/RestfulAtomActivityTest.java

Author: etnu
Date: Wed May 28 00:20:29 2008
New Revision: 660842

URL: http://svn.apache.org/viewvc?rev=660842&view=rev
Log:
Applied SHINDIG-311.


Modified:
    incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/abdera/AbstractSocialEntityCollectionAdapter.java
    incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/abdera/RestfulAtomActivityTest.java

Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/abdera/AbstractSocialEntityCollectionAdapter.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/abdera/AbstractSocialEntityCollectionAdapter.java?rev=660842&r1=660841&r2=660842&view=diff
==============================================================================
--- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/abdera/AbstractSocialEntityCollectionAdapter.java (original)
+++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/abdera/AbstractSocialEntityCollectionAdapter.java Wed May 28 00:20:29 2008
@@ -176,18 +176,21 @@
    * @param request RequestContext
    * @param resourceRouteVariable The route variable for the entry. So, for a
    *     route pattern of /:collection/:id, with "id" resourceRouteVariable this
-   *     would null out "id" in the generated URL.
+   *     would remove "id" in the generated URL.
    * @return The absolute request URI (includes server name, port, etc) URL for
    *     the collection of the entry.
    */
   public String getFeedIriForEntry(RequestContext request,
       String resourceRouteVariable) {
     Map<String, Object> params = Maps.newHashMap();
-    // TODO: currently a bug in Abdera adds this param to the url when there are
-    // other parameters in the original request.
-    // fix is coming in https://issues.apache.org/jira/browse/ABDERA-162
-    params.put(resourceRouteVariable, null);
-    String uri = request.urlFor(getRoute(request).getName(), params);
+    Route theRoute = getRoute(request);
+    for (String var: theRoute.getVariables()){
+      Object value = request.getTarget().getParameter(var);
+      if (!params.containsKey(var) && var != resourceRouteVariable) {
+        params.put(var, value);
+      }
+    }
+    String uri = request.urlFor(theRoute.getName(), params);
     return request.getResolvedUri().resolve(uri).toString();
   }
 

Modified: incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/abdera/RestfulAtomActivityTest.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/abdera/RestfulAtomActivityTest.java?rev=660842&r1=660841&r2=660842&view=diff
==============================================================================
--- incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/abdera/RestfulAtomActivityTest.java (original)
+++ incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/abdera/RestfulAtomActivityTest.java Wed May 28 00:20:29 2008
@@ -45,7 +45,7 @@
     resp = client.get(BASEURL + "/activities/john.doe/@self?format=atom");
     checkForGoodAtomResponse(resp);
     Document<Feed> doc = resp.getDocument();
-    String feedId = BASEURL + "/activities/john.doe/%40self?aid=";
+    String feedId = BASEURL + "/activities/john.doe/%40self";
     String title = RequestUrlTemplate.ACTIVITIES_OF_USER.toString();
     validateActivityAtomFeedElements(doc.getRoot(), title, feedId);
     // TODO Test all elements.
@@ -57,7 +57,7 @@
     checkForGoodAtomResponse(resp);
     Document<Feed> doc = resp.getDocument();
     prettyPrint(doc);
-    String feedId = BASEURL + "/activities/john.doe/%40friends?aid=";
+    String feedId = BASEURL + "/activities/john.doe/%40friends";
     String title = RequestUrlTemplate.ACTIVITIES_OF_FRIENDS_OF_USER.toString();
     validateActivityAtomFeedElements(doc.getRoot(), title, feedId);
     // TODO Social graph seems to make everyone friends at this point.