abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r617340 - /incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/RouteManager.java
Date Fri, 01 Feb 2008 03:22:25 GMT
Author: jmsnell
Date: Thu Jan 31 19:22:22 2008
New Revision: 617340

URL: http://svn.apache.org/viewvc?rev=617340&view=rev
Log:
Committing Jim's patch(https://issues.apache.org/jira/browse/ABDERA-95)

Modified:
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/RouteManager.java

Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/RouteManager.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/RouteManager.java?rev=617340&r1=617339&r2=617340&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/RouteManager.java
(original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/RouteManager.java
Thu Jan 31 19:22:22 2008
@@ -121,28 +121,24 @@
       return new RouteTarget(type, context, route, uri);
   }
   
-  @SuppressWarnings("unchecked")
   public String urlFor(
     RequestContext context, 
     Object key, 
     Object param) {
-      Route route = routes.get(key);
-    // return route != null ?
-    // route.expand(TemplateTargetBuilder.getContext(context,param)) :
-    // null;
+    Route route = routes.get(key);
     if (route != null) {
-      if (param instanceof Map) {
-        Map<String, Object> map = new HashMap<String,Object>((Map<String,
Object>)param);
-        for (String var : route.getVariables()) {
-          Object value = context.getTarget().getParameter(var);
-          if (!map.containsKey(var) && value != null) {
-            map.put(var, value);
-          }
+      Map<String, Object> map = new HashMap<String,Object>();
+      Context ctx = getContext(param);
+      for (String var : ctx) {
+        map.put(var, ctx.resolve(var));
+      }
+      for (String var : route.getVariables()) {
+        Object value = context.getTarget().getParameter(var);
+        if (!map.containsKey(var) && value != null) {
+          map.put(var, value);
         }
-        return route.expand(getContext(map));
-      } else {
-        return route.expand(getContext(param));
       }
+      return route.expand(getContext(map));
     } else {
       return null;
     }



Mime
View raw message