abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dand...@apache.org
Subject svn commit: r619246 - in /incubator/abdera/java/trunk/server/src: main/java/org/apache/abdera/protocol/server/impl/ test/java/org/apache/abdera/protocol/server/test/customer/
Date Thu, 07 Feb 2008 03:05:11 GMT
Author: dandiep
Date: Wed Feb  6 19:05:01 2008
New Revision: 619246

URL: http://svn.apache.org/viewvc?rev=619246&view=rev
Log:
ABDERA-101 - make URIs work correctly with a non root context path.

Modified:
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractProvider.java
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/DefaultWorkspaceManager.java
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/RouteManager.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/AbstractProvider.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractProvider.java?rev=619246&r1=619245&r2=619246&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractProvider.java
(original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractProvider.java
Wed Feb  6 19:05:01 2008
@@ -210,7 +210,7 @@
               sw.startWorkspace()
                 .writeTitle(wi.getTitle(request));
               for (CollectionInfo ci : wi.getCollections(request)) {
-                sw.startCollection(ci.getHref(request))
+                sw.startCollection(request.getTargetBasePath() + ci.getHref(request))
                   .writeTitle(ci.getTitle(request))
                   .writeAccepts(ci.getAccepts(request));
                 CategoriesInfo[] catinfos = ci.getCategoriesInfo(request);
@@ -219,7 +219,7 @@
                     String href = catinfo.getHref(request);
                     if (href != null) {
                       sw.startCategories()
-                        .writeAttribute("href", href)
+                        .writeAttribute("href", request.getTargetBasePath() + href)
                         .endCategories();
                     } else {
                       sw.startCategories(

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=619246&r1=619245&r2=619246&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
Wed Feb  6 19:05:01 2008
@@ -12,7 +12,7 @@
   public static final String COLLECTION_ADAPTER_ATTRIBUTE = "collectionProvider";
 
   public CollectionAdapter getCollectionAdapter(RequestContext request) {
-    String path = request.getTargetPath();
+    String path = request.getTargetBasePath() + request.getTargetPath();
     
     // Typically this happens when a Resolver wants to override the CollectionAdapter being
used
     CollectionAdapter ca = (CollectionAdapter) request.getAttribute(Scope.REQUEST, COLLECTION_ADAPTER_ATTRIBUTE);

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=619246&r1=619245&r2=619246&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
Wed Feb  6 19:05:01 2008
@@ -138,7 +138,7 @@
           map.put(var, value);
         }
       }
-      return route.expand(getContext(map));
+      return context.getTargetBasePath() + route.expand(getContext(map));
     } else {
       return null;
     }

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=619246&r1=619245&r2=619246&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
Wed Feb  6 19:05:01 2008
@@ -42,20 +42,28 @@
     wi.addCollection(ca);
     
     customerProvider.addWorkspace(wi);
-    
-    initializeJetty();
   }
 
   @Test
   public void testCustomerProvider() throws Exception {
     setupAbdera("/");
+    initializeJetty("/");
     
     runTests("/");
+  }  
+  
+  @Test
+  public void testCustomerProviderWithDifferentContextPath() throws Exception {
+    setupAbdera("/");
+    initializeJetty("/foo");
+    
+    runTests("/foo/");
   }
   
   @Test
   public void testCustomerProviderWithDifferentBase() throws Exception {
     setupAbdera("/:base/");
+    initializeJetty("/");
     
     runTests("/base/");
   }
@@ -129,10 +137,10 @@
   }
 
   @SuppressWarnings("serial") 
-  private void initializeJetty() throws Exception {
+  private void initializeJetty(String contextPath) throws Exception {
 
     server = new Server(9002);
-    Context root = new Context(server, "/", Context.NO_SESSIONS);
+    Context root = new Context(server, contextPath, Context.NO_SESSIONS);
     root.addServlet(new ServletHolder(new AbderaServlet() {
 
       @Override



Mime
View raw message