abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dand...@apache.org
Subject svn commit: r598793 - in /incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl: AbstractCollectionProvider.java AbstractWorkspaceProvider.java
Date Tue, 27 Nov 2007 22:37:11 GMT
Author: dandiep
Date: Tue Nov 27 14:37:10 2007
New Revision: 598793

URL: http://svn.apache.org/viewvc?rev=598793&view=rev
Log:
Decode portions of URLs so that the CollectionProvider implementor doesn't have to.

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

Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractCollectionProvider.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractCollectionProvider.java?rev=598793&r1=598792&r2=598793&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractCollectionProvider.java
(original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractCollectionProvider.java
Tue Nov 27 14:37:10 2007
@@ -26,6 +26,7 @@
 
 import org.apache.abdera.Abdera;
 import org.apache.abdera.factory.Factory;
+import org.apache.abdera.i18n.iri.Escaping;
 import org.apache.abdera.i18n.iri.IRI;
 import org.apache.abdera.model.Base;
 import org.apache.abdera.model.Content;
@@ -506,7 +507,8 @@
   protected String getEntryID(RequestContext request) {
     String path = request.getUri().toString();
     String[] segments = path.split("/");
-    return segments[segments.length - 1];
+    String id = segments[segments.length - 1];
+    return Escaping.decode(id);
   }
 
   protected IRI getMediaIRI(IRI entryBaseIri, String name) {

Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractWorkspaceProvider.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractWorkspaceProvider.java?rev=598793&r1=598792&r2=598793&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractWorkspaceProvider.java
(original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractWorkspaceProvider.java
Tue Nov 27 14:37:10 2007
@@ -34,6 +34,7 @@
 import org.apache.abdera.protocol.server.RequestContext;
 import org.apache.abdera.protocol.server.ResponseContext;
 import org.apache.abdera.protocol.server.WorkspaceInfo;
+import org.apache.abdera.protocol.util.EncodingUtil;
 import org.apache.abdera.util.EntityTag;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -116,24 +117,30 @@
                                                      RequestContext request) throws ResponseContextException
{
       String path = resolveBase.getPath();
       String[] paths = path.split("/");
+      String id = null;
+      WorkspaceInfo wp = null;
       if (paths.length < 1) {
         // TODO:
-        throw new RuntimeException();
+        throw new ResponseContextException(404);
       } else if (paths.length == 1) {
-        WorkspaceInfo wp = getWorkspaceInfo("");
+        wp = getWorkspaceInfo("");
         if (wp == null) {
           // TODO: 404
-          throw new RuntimeException();
+          throw new ResponseContextException(404);
         }
-        return wp.getCollectionProvider(paths[0]);
+        id = paths[0];
       } else {    
-        WorkspaceInfo wp = getWorkspaceInfo(paths[paths.length - 2]);
+        wp = getWorkspaceInfo(paths[paths.length - 2]);
         if (wp == null) {
           // TODO: 404
           throw new RuntimeException();
         }
-        return wp.getCollectionProvider(paths[paths.length - 1]);
+        id = paths[paths.length - 1];
       }
+      
+      id = Escaping.decode(id);
+      
+      return wp.getCollectionProvider(id);
     }
 
     /**



Mime
View raw message