abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dand...@apache.org
Subject svn commit: r617835 - /incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractEntityCollectionAdapter.java
Date Sat, 02 Feb 2008 17:09:41 GMT
Author: dandiep
Date: Sat Feb  2 09:09:41 2008
New Revision: 617835

URL: http://svn.apache.org/viewvc?rev=617835&view=rev
Log:
Fix bug where IRI threw an exception if there was a space in the resource name.

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

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=617835&r1=617834&r2=617835&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
Sat Feb  2 09:09:41 2008
@@ -27,6 +27,9 @@
 import org.apache.abdera.Abdera;
 import org.apache.abdera.factory.Factory;
 import org.apache.abdera.i18n.iri.IRI;
+import org.apache.abdera.i18n.text.Filter;
+import org.apache.abdera.i18n.text.UrlEncoding;
+import org.apache.abdera.i18n.text.CharUtils.Profile;
 import org.apache.abdera.model.Content;
 import org.apache.abdera.model.Entry;
 import org.apache.abdera.model.Feed;
@@ -156,6 +159,27 @@
 
   public abstract void deleteEntry(String resourceName, RequestContext request) throws ResponseContextException;
 
+  public ResponseContext deleteMedia(RequestContext request) {
+    String id = getEntryID(request);
+    if (id != null) {
+  
+      try {
+        deleteMedia(id, request);
+      } catch (ResponseContextException e) {
+        return createErrorResponse(e);
+      }
+      
+      return new EmptyResponseContext(204);
+    } else {
+      // TODO: is this right?
+      return new EmptyResponseContext(404);
+    }
+  }
+
+  public void deleteMedia(String resourceName, RequestContext request) throws ResponseContextException
{
+    throw new ResponseContextException(ProviderHelper.notsupported(request));
+  }
+
   public List<Person> getAuthors(T entry, RequestContext request) throws ResponseContextException
{
     return null;
   }
@@ -342,7 +366,8 @@
 
   protected void addEntryDetails(RequestContext request, Entry e, 
                                  IRI feedIri, T entryObj) throws ResponseContextException
{
-    IRI entryIri = feedIri.resolve(getName(entryObj));
+    String name = getName(entryObj);
+    IRI entryIri = feedIri.resolve(UrlEncoding.encode(name, Profile.PATH.filter()));
     e.addLink(entryIri.toString(), "edit");
     e.setId(getId(entryObj));
     e.setTitle(getTitle(entryObj));



Mime
View raw message