abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From calav...@apache.org
Subject svn commit: r669863 - in /incubator/abdera/java/trunk: dependencies/i18n/pom.xml server/src/main/java/org/apache/abdera/protocol/server/impl/RouteManager.java
Date Fri, 20 Jun 2008 11:44:09 GMT
Author: calavera
Date: Fri Jun 20 04:44:09 2008
New Revision: 669863

URL: http://svn.apache.org/viewvc?rev=669863&view=rev
Log:
added ordered routes collection

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

Modified: incubator/abdera/java/trunk/dependencies/i18n/pom.xml
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/i18n/pom.xml?rev=669863&r1=669862&r2=669863&view=diff
==============================================================================
--- incubator/abdera/java/trunk/dependencies/i18n/pom.xml (original)
+++ incubator/abdera/java/trunk/dependencies/i18n/pom.xml Fri Jun 20 04:44:09 2008
@@ -1,19 +1,19 @@
-<!--
-   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.
--->
+<!--
+   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.
+-->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 
   <modelVersion>4.0.0</modelVersion>

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=669863&r1=669862&r2=669863&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
Fri Jun 20 04:44:09 2008
@@ -22,6 +22,7 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Collection;
 
 import org.apache.abdera.i18n.templates.CachingContext;
 import org.apache.abdera.i18n.templates.Context;
@@ -57,6 +58,9 @@
   implements Resolver<Target>,
              TargetBuilder {
 
+  protected Collection<Route> orderedTargets =
+    new ArrayList<Route>();
+    
   protected Map<Route,TargetType> targets = 
     new HashMap<Route,TargetType>();
   
@@ -84,8 +88,10 @@
     Route route, 
     TargetType type) {
       routes.put(route.getName(), route);
-      if (type != null) 
+      if (type != null) {
         targets.put(route, type);
+        orderedTargets.add(route);
+      }
       return this;
   }
   
@@ -118,13 +124,13 @@
     if (idx != -1) {
       uri = uri.substring(0, idx);
     }
-    for(Map.Entry<Route, TargetType> entry : targets.entrySet()) {
-      if (entry.getKey().match(uri)) {
-        CollectionAdapter ca = route2CA.get(entry.getKey());
+    for (Route route : orderedTargets) {
+      if (route.match(uri)) {
+        CollectionAdapter ca = route2CA.get(route);
         if (ca != null) {
           context.setAttribute(DefaultWorkspaceManager.COLLECTION_ADAPTER_ATTRIBUTE, ca);
         }
-        return getTarget(context, entry.getKey(), uri, entry.getValue());
+        return getTarget(context, route, uri, targets.get(route));
       }
     }
     return null;



Mime
View raw message