jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r997947 - in /jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav: DavServletResponse.java WebdavResponseImpl.java server/AbstractWebdavServlet.java
Date Thu, 16 Sep 2010 23:08:47 GMT
Author: jukka
Date: Thu Sep 16 23:08:46 2010
New Revision: 997947

URL: http://svn.apache.org/viewvc?rev=997947&view=rev
Log:
JCR-2638: Litmus locks test failures

Fix a Litmus test warning as suggested by Javier Godoy.

After that fix the DavServletResponse.sendLockResponse(ActiveLock) method was no longer called
from anywhere, so it's probably best to simply remove it entirely.

Modified:
    jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/DavServletResponse.java
    jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/WebdavResponseImpl.java
    jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/server/AbstractWebdavServlet.java

Modified: jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/DavServletResponse.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/DavServletResponse.java?rev=997947&r1=997946&r2=997947&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/DavServletResponse.java
(original)
+++ jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/DavServletResponse.java
Thu Sep 16 23:08:46 2010
@@ -96,17 +96,6 @@ public interface DavServletResponse exte
     public void sendMultiStatus(MultiStatus multistatus) throws IOException;
 
     /**
-     * Send the lock response for a successful LOCK request. The given <code>ActiveLock</code>
-     * object is included in the lockdiscovery property of the response
-     * body as required by RFC 2518.
-     *
-     * @param lock
-     * @throws IOException
-     * @see DavConstants#PROPERTY_LOCKDISCOVERY
-     */
-    public void sendLockResponse(ActiveLock lock) throws IOException;
-
-    /**
      * Send the lock response for a successful LOCK request, that was intended
      * to refresh an existing lock. The locks array must contain at least
      * a single element; the <code>ActiveLock</code> objects are then

Modified: jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/WebdavResponseImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/WebdavResponseImpl.java?rev=997947&r1=997946&r2=997947&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/WebdavResponseImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/WebdavResponseImpl.java
Thu Sep 16 23:08:46 2010
@@ -114,22 +114,6 @@ public class WebdavResponseImpl implemen
     }
 
     /**
-     * Send response body for a lock request intended to create a new lock.
-     *
-     * @param lock
-     * @throws java.io.IOException
-     * @see DavServletResponse#sendLockResponse(org.apache.jackrabbit.webdav.lock.ActiveLock)
-     */
-    public void sendLockResponse(ActiveLock lock) throws IOException {
-        CodedUrlHeader ltHeader = new CodedUrlHeader(DavConstants.HEADER_LOCK_TOKEN, lock.getToken());
-        httpResponse.setHeader(ltHeader.getHeaderName(), ltHeader.getHeaderValue());
-
-        DavPropertySet propSet = new DavPropertySet();
-        propSet.add(new LockDiscovery(lock));
-        sendXmlResponse(propSet, SC_OK);
-    }
-
-    /**
      * Send response body for a lock request that was intended to refresh one
      * or several locks.
      *

Modified: jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/server/AbstractWebdavServlet.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/server/AbstractWebdavServlet.java?rev=997947&r1=997946&r2=997947&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/server/AbstractWebdavServlet.java
(original)
+++ jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/server/AbstractWebdavServlet.java
Thu Sep 16 23:08:46 2010
@@ -36,11 +36,13 @@ import org.apache.jackrabbit.webdav.bind
 import org.apache.jackrabbit.webdav.bind.UnbindInfo;
 import org.apache.jackrabbit.webdav.bind.BindableResource;
 import org.apache.jackrabbit.webdav.bind.BindInfo;
+import org.apache.jackrabbit.webdav.header.CodedUrlHeader;
 import org.apache.jackrabbit.webdav.io.InputContext;
 import org.apache.jackrabbit.webdav.io.InputContextImpl;
 import org.apache.jackrabbit.webdav.io.OutputContext;
 import org.apache.jackrabbit.webdav.io.OutputContextImpl;
 import org.apache.jackrabbit.webdav.lock.ActiveLock;
+import org.apache.jackrabbit.webdav.lock.LockDiscovery;
 import org.apache.jackrabbit.webdav.lock.LockInfo;
 import org.apache.jackrabbit.webdav.observation.EventDiscovery;
 import org.apache.jackrabbit.webdav.observation.ObservationResource;
@@ -51,6 +53,7 @@ import org.apache.jackrabbit.webdav.orde
 import org.apache.jackrabbit.webdav.property.DavProperty;
 import org.apache.jackrabbit.webdav.property.DavPropertyName;
 import org.apache.jackrabbit.webdav.property.DavPropertyNameSet;
+import org.apache.jackrabbit.webdav.property.DavPropertySet;
 import org.apache.jackrabbit.webdav.property.PropEntry;
 import org.apache.jackrabbit.webdav.search.SearchConstants;
 import org.apache.jackrabbit.webdav.search.SearchInfo;
@@ -800,9 +803,22 @@ abstract public class AbstractWebdavServ
             ActiveLock[] refreshedLocks = lList.toArray(new ActiveLock[lList.size()]);
             response.sendRefreshLockResponse(refreshedLocks);
         } else {
+            int status = HttpServletResponse.SC_OK;
+            if (!resource.exists()) {
+                // lock-empty requires status code 201 (Created)
+                status = HttpServletResponse.SC_CREATED;
+            }
+
             // create a new lock
-            ActiveLock lock = resource.lock(lockInfo);
-            response.sendLockResponse(lock);
+            ActiveLock lock = resource.lock(lockInfo); 
+
+            CodedUrlHeader header = new CodedUrlHeader(
+                    DavConstants.HEADER_LOCK_TOKEN, lock.getToken()); 
+            response.setHeader(header.getHeaderName(), header.getHeaderValue()); 
+
+            DavPropertySet propSet = new DavPropertySet(); 
+            propSet.add(new LockDiscovery(lock)); 
+            response.sendXmlResponse(propSet, status); 
         }
     }
 



Mime
View raw message