abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r619767 - in /incubator/abdera/java/trunk/server/src: main/java/org/apache/abdera/protocol/server/impl/DefaultWorkspaceManager.java test/java/org/apache/abdera/protocol/server/test/customer/CustomerAdapterTest.java
Date Fri, 08 Feb 2008 04:57:13 GMT
Author: jmsnell
Date: Thu Feb  7 20:57:12 2008
New Revision: 619767

URL: http://svn.apache.org/viewvc?rev=619767&view=rev
Log:
Per https://issues.apache.org/jira/browse/ABDERA-108

Modified:
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/DefaultWorkspaceManager.java
    incubator/abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/test/customer/CustomerAdapterTest.java

Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/DefaultWorkspaceManager.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/DefaultWorkspaceManager.java?rev=619767&r1=619766&r2=619767&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/DefaultWorkspaceManager.java
(original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/DefaultWorkspaceManager.java
Thu Feb  7 20:57:12 2008
@@ -8,7 +8,8 @@
 
 
 public class DefaultWorkspaceManager extends AbstractWorkspaceManager {
-
+  // URI reserved delimiter characters (gen-delims) from RFC 3986 section 2.2
+  private static final String URI_GEN_DELIMS = ":/?#[]@";
   public static final String COLLECTION_ADAPTER_ATTRIBUTE = "collectionProvider";
 
   public CollectionAdapter getCollectionAdapter(RequestContext request) {
@@ -19,11 +20,13 @@
     if (ca != null) {
       return ca;
     }
-    
     for (WorkspaceInfo wi : workspaces) {
       for (CollectionInfo ci : wi.getCollections(request)) {
         String href = ci.getHref(request);
-        if (href != null && path.startsWith(href)) {
+        if (path.equals(href) ||
+          (href != null && 
+           path.startsWith(href) &&
+           URI_GEN_DELIMS.contains(path.substring(href.length(), href.length() + 1)))) {
           return (CollectionAdapter) ci;
         }
       }

Modified: incubator/abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/test/customer/CustomerAdapterTest.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/test/customer/CustomerAdapterTest.java?rev=619767&r1=619766&r2=619767&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/test/customer/CustomerAdapterTest.java
(original)
+++ incubator/abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/test/customer/CustomerAdapterTest.java
Thu Feb  7 20:57:12 2008
@@ -170,6 +170,15 @@
     assertEquals(404, res.getStatus());
     assertEquals(0, res.getContentLength());
     res.release();
+    
+    IRI badColUri = new IRI(uri).resolve("customersbad"); 
+    // GET the service doc
+    res = client.get(colUri.toString());
+    assertEquals(200, res.getStatus());
+    res.release();
+    res = client.get(badColUri.toString());
+    assertEquals(404, res.getStatus());
+    res.release();
   }
 
   protected void prettyPrint(Abdera abdera, Base doc) throws IOException {



Mime
View raw message