abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r1189957 - in /abdera/abdera2: activities/src/main/java/org/apache/abdera2/activities/protocol/ common/src/main/java/org/apache/abdera2/common/protocol/ common/src/main/java/org/apache/abdera2/common/protocol/servlet/ common/src/main/java/o...
Date Thu, 27 Oct 2011 19:30:25 GMT
Author: jmsnell
Date: Thu Oct 27 19:30:24 2011
New Revision: 1189957

URL: http://svn.apache.org/viewvc?rev=1189957&view=rev
Log:
Fixes...

Modified:
    abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/AbstractActivitiesCollectionAdapter.java
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractCollectionAdapter.java
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/servlet/AbstractAbderaServlet.java
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/servlet/async/AbderaTask.java
    abdera/abdera2/server/src/main/java/org/apache/abdera2/protocol/server/impl/AbstractAtompubCollectionAdapter.java
    abdera/abdera2/server/src/main/java/org/apache/abdera2/protocol/server/impl/AbstractAtompubWorkspaceProvider.java
    abdera/abdera2/server/src/main/java/org/apache/abdera2/protocol/server/multipart/AbstractMultipartCollectionAdapter.java

Modified: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/AbstractActivitiesCollectionAdapter.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/AbstractActivitiesCollectionAdapter.java?rev=1189957&r1=1189956&r2=1189957&view=diff
==============================================================================
--- abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/AbstractActivitiesCollectionAdapter.java
(original)
+++ abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/AbstractActivitiesCollectionAdapter.java
Thu Oct 27 19:30:24 2011
@@ -35,6 +35,7 @@ import org.apache.abdera2.common.protoco
 import org.joda.time.DateTime;
 
 import com.google.common.base.Predicate;
+import com.google.common.base.Predicates;
 
 public abstract class AbstractActivitiesCollectionAdapter
   extends AbstractCollectionAdapter
@@ -119,6 +120,6 @@ public abstract class AbstractActivities
   }
 
   public Predicate<RequestContext> acceptable() {
-    return AbstractActivitiesWorkspaceProvider.isJson();
+    return Predicates.or(super.acceptable(),AbstractActivitiesWorkspaceProvider.isJson());
   }
 }

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractCollectionAdapter.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractCollectionAdapter.java?rev=1189957&r1=1189956&r2=1189957&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractCollectionAdapter.java
(original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractCollectionAdapter.java
Thu Oct 27 19:30:24 2011
@@ -21,6 +21,7 @@ import java.io.Serializable;
 import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.abdera2.activities.protocol.AbstractActivitiesWorkspaceProvider;
 import org.apache.abdera2.common.text.UrlEncoding;
 import org.apache.abdera2.common.date.DateTimes;
 import org.apache.abdera2.common.http.EntityTag;
@@ -211,4 +212,19 @@ public abstract class AbstractCollection
           return ProviderHelper.notfound(input);
         }
     };
+    
+    public static Predicate<RequestContext> HAS_NO_ENTITY = 
+      new Predicate<RequestContext>() {
+        public boolean apply(RequestContext input) {
+          String method = input.getMethod();
+          return method.equalsIgnoreCase("GET") ||
+                 method.equalsIgnoreCase("DELETE") ||
+                 method.equalsIgnoreCase("HEAD") ||
+                 method.equalsIgnoreCase("OPTIONS");
+        }
+    };
+    
+    public Predicate<RequestContext> acceptable() {
+      return HAS_NO_ENTITY;
+    }
 }

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/servlet/AbstractAbderaServlet.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/servlet/AbstractAbderaServlet.java?rev=1189957&r1=1189956&r2=1189957&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/servlet/AbstractAbderaServlet.java
(original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/servlet/AbstractAbderaServlet.java
Thu Oct 27 19:30:24 2011
@@ -18,6 +18,7 @@
 package org.apache.abdera2.common.protocol.servlet;
 
 import java.io.IOException;
+import java.util.Calendar;
 import java.util.Date;
 import java.util.Enumeration;
 import java.util.HashMap;
@@ -38,6 +39,7 @@ import org.apache.abdera2.common.protoco
 import org.apache.abdera2.common.protocol.ServiceManager;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.joda.time.DateTime;
 
 public abstract class AbstractAbderaServlet
   extends HttpServlet {
@@ -116,6 +118,10 @@ public abstract class AbstractAbderaServ
                 for (Object value : headers) {
                     if (value instanceof Date)
                         response.addDateHeader(name, ((Date)value).getTime());
+                    else if (value instanceof DateTime)
+                        response.addDateHeader(name, ((DateTime)value).getMillis());
+                    else if (value instanceof Calendar)
+                        response.addDateHeader(name, ((Calendar)value).getTimeInMillis());
                     else
                         response.addHeader(name, value.toString());
                 }

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/servlet/async/AbderaTask.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/servlet/async/AbderaTask.java?rev=1189957&r1=1189956&r2=1189957&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/servlet/async/AbderaTask.java
(original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/servlet/async/AbderaTask.java
Thu Oct 27 19:30:24 2011
@@ -18,6 +18,7 @@
 package org.apache.abdera2.common.protocol.servlet.async;
 
 import java.io.IOException;
+import java.util.Calendar;
 import java.util.Date;
 import java.util.UUID;
 
@@ -32,6 +33,7 @@ import org.apache.abdera2.common.protoco
 import org.apache.abdera2.common.protocol.Provider;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.joda.time.DateTime;
 
 public class AbderaTask {
 
@@ -131,10 +133,14 @@ public class AbderaTask {
                 Iterable<Object> headers = context.getHeaders(name);
                 for (Object value : headers) {
                   log.debug(String.format("Header [%s]: %s", name, value.toString()));
-                    if (value instanceof Date)
-                        response.addDateHeader(name, ((Date)value).getTime());
-                    else
-                        response.addHeader(name, value.toString());
+                  if (value instanceof Date)
+                    response.addDateHeader(name, ((Date)value).getTime());
+                  else if (value instanceof DateTime)
+                    response.addDateHeader(name, ((DateTime)value).getMillis());
+                  else if (value instanceof Calendar)
+                    response.addDateHeader(name, ((Calendar)value).getTimeInMillis());
+                  else
+                    response.addHeader(name, value.toString());
                 }
             }
             if (!request.getMethod().equals("HEAD") && context.hasEntity()) {

Modified: abdera/abdera2/server/src/main/java/org/apache/abdera2/protocol/server/impl/AbstractAtompubCollectionAdapter.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/server/src/main/java/org/apache/abdera2/protocol/server/impl/AbstractAtompubCollectionAdapter.java?rev=1189957&r1=1189956&r2=1189957&view=diff
==============================================================================
--- abdera/abdera2/server/src/main/java/org/apache/abdera2/protocol/server/impl/AbstractAtompubCollectionAdapter.java
(original)
+++ abdera/abdera2/server/src/main/java/org/apache/abdera2/protocol/server/impl/AbstractAtompubCollectionAdapter.java
Thu Oct 27 19:30:24 2011
@@ -39,6 +39,7 @@ import org.apache.abdera2.protocol.serve
 import org.joda.time.DateTime;
 
 import com.google.common.base.Predicate;
+import com.google.common.base.Predicates;
 
 /**
  * Base CollectionAdapter implementation that provides a number of helper utility methods
for adapter implementations.
@@ -147,6 +148,6 @@ public abstract class AbstractAtompubCol
     }
     
     public Predicate<RequestContext> acceptable() {
-      return ProviderHelper.isAtom();
+      return Predicates.or(super.acceptable(),ProviderHelper.isAtom());
     }
 }

Modified: abdera/abdera2/server/src/main/java/org/apache/abdera2/protocol/server/impl/AbstractAtompubWorkspaceProvider.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/server/src/main/java/org/apache/abdera2/protocol/server/impl/AbstractAtompubWorkspaceProvider.java?rev=1189957&r1=1189956&r2=1189957&view=diff
==============================================================================
--- abdera/abdera2/server/src/main/java/org/apache/abdera2/protocol/server/impl/AbstractAtompubWorkspaceProvider.java
(original)
+++ abdera/abdera2/server/src/main/java/org/apache/abdera2/protocol/server/impl/AbstractAtompubWorkspaceProvider.java
Thu Oct 27 19:30:24 2011
@@ -30,6 +30,7 @@ import org.apache.abdera2.common.protoco
 import org.apache.abdera2.common.protocol.TargetType;
 import org.apache.abdera2.protocol.server.AtompubProvider;
 import org.apache.abdera2.protocol.server.model.AtompubWorkspaceManager;
+import org.apache.abdera2.protocol.server.processors.CategoriesRequestProcessor;
 import org.apache.abdera2.protocol.server.processors.ServiceRequestProcessor;
 
 public abstract class AbstractAtompubWorkspaceProvider 
@@ -48,7 +49,7 @@ public abstract class AbstractAtompubWor
     this.requestProcessors.put(
       TargetType.TYPE_CATEGORIES, 
       RequestProcessor.forClass(
-        ServiceRequestProcessor.class, 
+          CategoriesRequestProcessor.class, 
         this));
     this.requestProcessors.put(
       TargetType.TYPE_COLLECTION,

Modified: abdera/abdera2/server/src/main/java/org/apache/abdera2/protocol/server/multipart/AbstractMultipartCollectionAdapter.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/server/src/main/java/org/apache/abdera2/protocol/server/multipart/AbstractMultipartCollectionAdapter.java?rev=1189957&r1=1189956&r2=1189957&view=diff
==============================================================================
--- abdera/abdera2/server/src/main/java/org/apache/abdera2/protocol/server/multipart/AbstractMultipartCollectionAdapter.java
(original)
+++ abdera/abdera2/server/src/main/java/org/apache/abdera2/protocol/server/multipart/AbstractMultipartCollectionAdapter.java
Thu Oct 27 19:30:24 2011
@@ -42,10 +42,12 @@ import org.apache.abdera2.protocol.serve
 import org.apache.abdera2.common.Constants;
 import org.apache.abdera2.common.io.MultipartInputStream;
 import org.apache.abdera2.common.mediatype.MimeTypeHelper;
+import org.apache.abdera2.common.protocol.AbstractCollectionAdapter;
 import org.apache.abdera2.common.protocol.RequestContext;
 import org.apache.commons.codec.binary.Base64;
 
 import com.google.common.base.Predicate;
+import com.google.common.base.Predicates;
 import com.google.common.collect.Iterables;
 
 @SuppressWarnings("unchecked")
@@ -66,14 +68,16 @@ public abstract class AbstractMultipartC
     protected Map<String, String> accepts;
 
     public Predicate<RequestContext> acceptable() {
-      return new Predicate<RequestContext>() {
+      return Predicates.or(
+        AbstractCollectionAdapter.HAS_NO_ENTITY,
+        new Predicate<RequestContext>() {
         public boolean apply(RequestContext input) {
           MimeType mt = input.getContentType();
           if (mt == null) return false;
           return MimeTypeHelper.isMultipart(mt.toString()) ||
                  MimeTypeHelper.isAtom(mt.toString());
         }
-      };
+      });
     }
     
     public Iterable<String> getAccepts(RequestContext request) {



Mime
View raw message