abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dand...@apache.org
Subject svn commit: r618099 - in /incubator/abdera/java/trunk: security/src/test/java/org/apache/abdera/test/security/filter/ server/src/main/java/org/apache/abdera/protocol/server/ server/src/main/java/org/apache/abdera/protocol/server/impl/ server/src/main/j...
Date Sun, 03 Feb 2008 21:52:15 GMT
Author: dandiep
Date: Sun Feb  3 13:52:12 2008
New Revision: 618099

URL: http://svn.apache.org/viewvc?rev=618099&view=rev
Log:
HEAD/OPTIONS suport for CollectionAdapter/MediaCollectionAdapter.

Modified:
    incubator/abdera/java/trunk/security/src/test/java/org/apache/abdera/test/security/filter/SimpleAdapter.java
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/CollectionAdapter.java
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/MediaCollectionAdapter.java
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractCollectionAdapter.java
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractEntityCollectionAdapter.java
    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/provider/basic/BasicAdapter.java
    incubator/abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/test/basic/BasicTest.java
    incubator/abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/test/basic/SampleBasicAdapter.java
    incubator/abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/test/custom/CustomProviderTest.java
    incubator/abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/test/custom/SimpleAdapter.java
    incubator/abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/test/customer/CustomerAdapterTest.java

Modified: incubator/abdera/java/trunk/security/src/test/java/org/apache/abdera/test/security/filter/SimpleAdapter.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/security/src/test/java/org/apache/abdera/test/security/filter/SimpleAdapter.java?rev=618099&r1=618098&r2=618099&view=diff
==============================================================================
--- incubator/abdera/java/trunk/security/src/test/java/org/apache/abdera/test/security/filter/SimpleAdapter.java
(original)
+++ incubator/abdera/java/trunk/security/src/test/java/org/apache/abdera/test/security/filter/SimpleAdapter.java
Sun Feb  3 13:52:12 2008
@@ -233,12 +233,12 @@
           request)
             .getRoot()
             .getEntry(
-              getEntryID(request)); 
+              getResourceName(request)); 
       } catch (Exception e) {}
       return null;
   }
   
-  public String getEntryID(
+  public String getResourceName(
     RequestContext request) {
       if (request.getTarget().getType() != TargetType.TYPE_ENTRY) 
         return null;

Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/CollectionAdapter.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/CollectionAdapter.java?rev=618099&r1=618098&r2=618099&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/CollectionAdapter.java
(original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/CollectionAdapter.java
Sun Feb  3 13:52:12 2008
@@ -42,6 +42,16 @@
   ResponseContext getEntry(RequestContext request);
   
   /**
+   * Get metadata for an entry from the collection
+   */
+  ResponseContext headEntry(RequestContext request);
+  
+  /**
+   * Get options for an entry from the collection
+   */
+  ResponseContext optionsEntry(RequestContext request);
+  
+  /**
    * Update an existing entry
    */
   ResponseContext putEntry(RequestContext request);

Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/MediaCollectionAdapter.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/MediaCollectionAdapter.java?rev=618099&r1=618098&r2=618099&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/MediaCollectionAdapter.java
(original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/MediaCollectionAdapter.java
Sun Feb  3 13:52:12 2008
@@ -39,6 +39,16 @@
    * Get a media resource
    */
   ResponseContext getMedia(RequestContext request);
+
+  /**
+   * Get metdata for a media resource
+   */
+  ResponseContext headMedia(RequestContext request);
+
+  /**
+   * Get a media resource's options.
+   */
+  ResponseContext optionsMedia(RequestContext request);
   
   /**
    * Update a media resource

Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractCollectionAdapter.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractCollectionAdapter.java?rev=618099&r1=618098&r2=618099&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractCollectionAdapter.java
(original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractCollectionAdapter.java
Sun Feb  3 13:52:12 2008
@@ -11,6 +11,7 @@
 import org.apache.abdera.factory.Factory;
 import org.apache.abdera.i18n.iri.IRI;
 import org.apache.abdera.i18n.text.UrlEncoding;
+import org.apache.abdera.model.AtomDate;
 import org.apache.abdera.model.Collection;
 import org.apache.abdera.model.Document;
 import org.apache.abdera.model.Entry;
@@ -29,6 +30,7 @@
 import org.apache.abdera.protocol.server.context.BaseResponseContext;
 import org.apache.abdera.protocol.server.context.EmptyResponseContext;
 import org.apache.abdera.protocol.server.context.ResponseContextException;
+import org.apache.abdera.util.EntityTag;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -82,19 +84,35 @@
   }
 
   public ResponseContext deleteMedia(RequestContext request) {
-    return ProviderHelper.notallowed(request);
+    return ProviderHelper.notsupported(request);
   }
 
   public ResponseContext getMedia(RequestContext request) {
-    return ProviderHelper.notallowed(request);
+    return ProviderHelper.notsupported(request);
+  }
+
+  public ResponseContext headMedia(RequestContext request) {
+    return ProviderHelper.notsupported(request);
+  }
+
+  public ResponseContext optionsMedia(RequestContext request) {
+    return ProviderHelper.notsupported(request);
   }
 
   public ResponseContext putMedia(RequestContext request) {
-    return ProviderHelper.notallowed(request);
+    return ProviderHelper.notsupported(request);
   }
 
   public ResponseContext postMedia(RequestContext request) {
-    return ProviderHelper.notallowed(request);
+    return ProviderHelper.notsupported(request);
+  }
+
+  public ResponseContext headEntry(RequestContext request) {
+    return ProviderHelper.notsupported(request);
+  }
+
+  public ResponseContext optionsEntry(RequestContext request) {
+    return ProviderHelper.notsupported(request);
   }
 
   public abstract String getAuthor() throws ResponseContextException;
@@ -122,6 +140,14 @@
     rc.setEntityTag(calculateEntityTag(entry));
     return rc;
   }
+  
+  protected ResponseContext buildHeadEntryResponse(RequestContext request, 
+                                                   String id,
+                                                   Date updated) throws ResponseContextException
{
+    EmptyResponseContext rc = new EmptyResponseContext(200);
+    rc.setEntityTag(EntityTag.generate(id, AtomDate.format(updated)));
+    return rc;
+  }
 
   protected ResponseContext buildGetFeedResponse(Feed feed) {
     Document<Feed> document = feed.getDocument();
@@ -179,7 +205,7 @@
     return entry_doc.getRoot();
   }
 
-  protected String getEntryID(RequestContext request) {
+  protected String getResourceName(RequestContext request) {
     String path = request.getTargetPath();
     int q = path.indexOf("?");
     if (q != -1) {

Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractEntityCollectionAdapter.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractEntityCollectionAdapter.java?rev=618099&r1=618098&r2=618099&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractEntityCollectionAdapter.java
(original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractEntityCollectionAdapter.java
Sun Feb  3 13:52:12 2008
@@ -17,6 +17,8 @@
 */
 package org.apache.abdera.protocol.server.impl;
 
+import static org.apache.abdera.protocol.server.ProviderHelper.calculateEntityTag;
+
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.Date;
@@ -27,6 +29,7 @@
 import org.apache.abdera.Abdera;
 import org.apache.abdera.factory.Factory;
 import org.apache.abdera.i18n.iri.IRI;
+import org.apache.abdera.model.AtomDate;
 import org.apache.abdera.i18n.text.Filter;
 import org.apache.abdera.i18n.text.UrlEncoding;
 import org.apache.abdera.i18n.text.CharUtils.Profile;
@@ -42,6 +45,7 @@
 import org.apache.abdera.protocol.server.context.EmptyResponseContext;
 import org.apache.abdera.protocol.server.context.MediaResponseContext;
 import org.apache.abdera.protocol.server.context.ResponseContextException;
+import org.apache.abdera.util.EntityTag;
 import org.apache.abdera.util.MimeTypeHelper;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -85,7 +89,7 @@
   @Override
   public ResponseContext putMedia(RequestContext request) {
     try {
-      String id = getEntryID(request);
+      String id = getResourceName(request);
       T entryObj = getEntry(id, request);
       
       putMedia(entryObj, request.getContentType(), request.getSlug(), 
@@ -167,7 +171,7 @@
   }
 
   public ResponseContext deleteEntry(RequestContext request) {
-    String id = getEntryID(request);
+    String id = getResourceName(request);
     if (id != null) {
   
       try {
@@ -186,11 +190,11 @@
   public abstract void deleteEntry(String resourceName, RequestContext request) throws ResponseContextException;
 
   public ResponseContext deleteMedia(RequestContext request) {
-    String id = getEntryID(request);
-    if (id != null) {
+    String resourceName = getResourceName(request);
+    if (resourceName != null) {
   
       try {
-        deleteMedia(id, request);
+        deleteMedia(resourceName, request);
       } catch (ResponseContextException e) {
         return createErrorResponse(e);
       }
@@ -235,6 +239,35 @@
 
   public abstract T getEntry(String resourceName, RequestContext request) throws ResponseContextException;
 
+  public ResponseContext headEntry(RequestContext request) {
+    try {
+      String resourceName = getResourceName(request);
+      T entryObj = getEntry(resourceName, request);
+
+      if (entryObj != null) {
+        return buildHeadEntryResponse(request, resourceName, getUpdated(entryObj));
+      } else {
+        return new EmptyResponseContext(404);
+      }
+    } catch (ResponseContextException e) {
+      return createErrorResponse(e);
+    }
+  }
+
+  public ResponseContext headMedia(RequestContext request) {
+    try {
+      String resourceName = getResourceName(request);
+      T entryObj = getEntry(resourceName, request);
+
+      if (entryObj != null) {
+        return buildHeadEntryResponse(request, resourceName, getUpdated(entryObj));
+      } else {
+        return new EmptyResponseContext(404);
+      }
+    } catch (ResponseContextException e) {
+      return createErrorResponse(e);
+    }
+  }
   public ResponseContext getFeed(RequestContext request) {
     try {
       Feed feed = createFeedBase(request);
@@ -285,14 +318,14 @@
 
   public ResponseContext getMedia(RequestContext request) {
     try {
-      String id = getEntryID(request);
-      T entryObj = getEntry(id, request);
+      String resource = getResourceName(request);
+      T entryObj = getEntry(resource, request);
 
       if (entryObj == null) {
         return new EmptyResponseContext(404);
       }
 
-      return buildGetMediaResponse(entryObj);
+      return buildGetMediaResponse(resource, entryObj);
     } catch (ParseException pe) {
       return new EmptyResponseContext(415);
     } catch (ClassCastException cce) {
@@ -305,12 +338,13 @@
     }
   }
 
-  protected ResponseContext buildGetMediaResponse(T entryObj) throws ResponseContextException
{
+  protected ResponseContext buildGetMediaResponse(String id, T entryObj) throws ResponseContextException
{
+    Date updated = getUpdated(entryObj);
     MediaResponseContext ctx = new MediaResponseContext(getMediaStream(entryObj), 
-                                                        getUpdated(entryObj), 
+                                                        updated, 
                                                         200);
     ctx.setContentType(getContentType(entryObj));
-
+    ctx.setEntityTag(EntityTag.generate(id, AtomDate.format(updated)));
     return ctx;
   }
   public String getMediaName(T entry) throws ResponseContextException {
@@ -333,7 +367,7 @@
   
   public ResponseContext putEntry(RequestContext request) {
     try {
-      String id = getEntryID(request);
+      String id = getResourceName(request);
       T entryObj = getEntry(id, request);
       
       if (entryObj == null) {
@@ -494,7 +528,7 @@
   }
 
   protected Entry getEntryFromCollectionProvider(RequestContext request) throws ResponseContextException
{
-    String id = getEntryID(request);
+    String id = getResourceName(request);
     T entryObj = getEntry(id, request);
 
     if (entryObj == null) {

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=618099&r1=618098&r2=618099&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
Sun Feb  3 13:52:12 2008
@@ -146,6 +146,10 @@
             response = adapter.putEntry(request);
           else if (method.equalsIgnoreCase("DELETE")) 
             response = adapter.deleteEntry(request);
+          else if (method.equalsIgnoreCase("HEAD")) 
+            response = adapter.headEntry(request);
+          else if (method.equalsIgnoreCase("OPTIONS")) 
+            response = adapter.optionsEntry(request);
         } else if (type == TargetType.TYPE_MEDIA) {
           if (adapter instanceof MediaCollectionAdapter) {
             MediaCollectionAdapter mcadapter = 
@@ -155,7 +159,11 @@
             else if (method.equalsIgnoreCase("PUT")) 
               response = mcadapter.putMedia(request);
             else if (method.equalsIgnoreCase("DELETE")) 
-              response = mcadapter.deleteMedia(request);        
+              response = mcadapter.deleteMedia(request);   
+            else if (method.equalsIgnoreCase("HEAD")) 
+              response = mcadapter.headMedia(request);   
+            else if (method.equalsIgnoreCase("OPTIONS")) 
+              response = mcadapter.optionsMedia(request);        
           } else {
             response = ProviderHelper.notsupported(request);
           }

Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/provider/basic/BasicAdapter.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/provider/basic/BasicAdapter.java?rev=618099&r1=618098&r2=618099&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/provider/basic/BasicAdapter.java
(original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/provider/basic/BasicAdapter.java
Sun Feb  3 13:52:12 2008
@@ -33,9 +33,11 @@
 import org.apache.abdera.protocol.server.RequestContext;
 import org.apache.abdera.protocol.server.ResponseContext;
 import org.apache.abdera.protocol.server.Target;
+import org.apache.abdera.protocol.server.impl.AbstractCollectionAdapter;
 import org.apache.abdera.util.MimeTypeHelper;
 
 public abstract class BasicAdapter 
+  extends AbstractCollectionAdapter
   implements CollectionAdapter {
 
   public static Logger logger =

Modified: incubator/abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/test/basic/BasicTest.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/test/basic/BasicTest.java?rev=618099&r1=618098&r2=618099&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/test/basic/BasicTest.java
(original)
+++ incubator/abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/test/basic/BasicTest.java
Sun Feb  3 13:52:12 2008
@@ -18,11 +18,11 @@
 package org.apache.abdera.protocol.server.test.basic;
 
 import java.io.ByteArrayInputStream;
+import java.io.IOException;
 import java.util.Date;
 
-import junit.framework.Assert;
-
 import org.apache.abdera.Abdera;
+import org.apache.abdera.model.Base;
 import org.apache.abdera.model.Collection;
 import org.apache.abdera.model.Document;
 import org.apache.abdera.model.Entry;
@@ -37,10 +37,14 @@
 import org.apache.abdera.protocol.server.test.JettyServer;
 import org.apache.abdera.util.Constants;
 import org.apache.abdera.util.MimeTypeHelper;
+import org.apache.abdera.writer.Writer;
+import org.apache.abdera.writer.WriterFactory;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
+import junit.framework.Assert;
+
 public class BasicTest extends Assert {
 
   private static JettyServer server;
@@ -59,6 +63,14 @@
   public static void tearDown() throws Exception {
     server.stop();
   }
+
+  protected void prettyPrint(Base doc) throws IOException {
+    WriterFactory factory = abdera.getWriterFactory();
+    Writer writer = factory.getWriter("prettyxml");
+    writer.writeTo(doc, System.out);
+    System.out.println();
+  }
+
   @Test
   public void testGetService() {
     ClientResponse resp = client.get("http://localhost:9002/");

Modified: incubator/abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/test/basic/SampleBasicAdapter.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/test/basic/SampleBasicAdapter.java?rev=618099&r1=618098&r2=618099&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/test/basic/SampleBasicAdapter.java
(original)
+++ incubator/abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/test/basic/SampleBasicAdapter.java
Sun Feb  3 13:52:12 2008
@@ -30,6 +30,8 @@
 import org.apache.abdera.model.Element;
 import org.apache.abdera.model.Entry;
 import org.apache.abdera.model.Feed;
+import org.apache.abdera.protocol.server.RequestContext;
+import org.apache.abdera.protocol.server.context.ResponseContextException;
 import org.apache.abdera.protocol.server.provider.basic.BasicAdapter;
 
 public class SampleBasicAdapter 
@@ -136,6 +138,24 @@
     Document<Entry> entryDoc = abdera.getParser().parse(in);
     Entry entry = entryDoc.getRoot();
     return entry;
+  }
+
+
+  @Override
+  public String getAuthor() throws ResponseContextException {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  @Override
+  public String getId(RequestContext request) {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  public String getTitle(RequestContext request) {
+    // TODO Auto-generated method stub
+    return null;
   }
 }
 

Modified: incubator/abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/test/custom/CustomProviderTest.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/test/custom/CustomProviderTest.java?rev=618099&r1=618098&r2=618099&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/test/custom/CustomProviderTest.java
(original)
+++ incubator/abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/test/custom/CustomProviderTest.java
Sun Feb  3 13:52:12 2008
@@ -151,7 +151,7 @@
     options.setContentType("application/octet-stream");
     ClientResponse resp = client.post("http://localhost:9002/atom/feed", in, options);
     assertEquals(resp.getType(), ResponseType.CLIENT_ERROR);
-    assertEquals(resp.getStatus(), 405);
+    assertEquals(resp.getStatus(), 415);
     resp.release();
   }
 

Modified: incubator/abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/test/custom/SimpleAdapter.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/test/custom/SimpleAdapter.java?rev=618099&r1=618098&r2=618099&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/test/custom/SimpleAdapter.java
(original)
+++ incubator/abdera/java/trunk/server/src/test/java/org/apache/abdera/protocol/server/test/custom/SimpleAdapter.java
Sun Feb  3 13:52:12 2008
@@ -233,12 +233,12 @@
           request)
             .getRoot()
             .getEntry(
-              getEntryID(request)); 
+              getResourceName(request)); 
       } catch (Exception e) {}
       return null;
   }
   
-  public String getEntryID(
+  public String getResourceName(
     RequestContext request) {
       if (request.getTarget().getType() != TargetType.TYPE_ENTRY) 
         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=618099&r1=618098&r2=618099&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
Sun Feb  3 13:52:12 2008
@@ -96,14 +96,28 @@
     // GET the entry
     res = client.get(colUri.resolve(location.toString()).toString());
     assertEquals(200, res.getStatus());
+    res.release();
 
     // prettyPrint(abdera, res.getDocument());
     org.apache.abdera.model.Document<Entry> entry_doc = res.getDocument();
     prettyPrint(abdera, entry_doc);
     entry = entry_doc.getRoot();
-
+    
+    // HEAD
+    res = client.head(colUri.resolve(location.toString()).toString());
+    assertEquals(200, res.getStatus());
+    assertEquals(0, res.getContentLength());
+    res.release();
+    
+    // Try invalid resources
     res = client.get(colUri + "/foobar");
     assertEquals(404, res.getStatus());
+    res.release();
+
+    res = client.head(colUri + "/foobar");
+    assertEquals(404, res.getStatus());
+    assertEquals(0, res.getContentLength());
+    res.release();
   }
 
   protected void prettyPrint(Abdera abdera, Base doc) throws IOException {



Mime
View raw message