jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r397929 - /jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/
Date Fri, 28 Apr 2006 15:47:16 GMT
Author: angela
Date: Fri Apr 28 08:47:14 2006
New Revision: 397929

URL: http://svn.apache.org/viewcvs?rev=397929&view=rev
Log:
- DavMethod: common interface for webdav extension of HttpClient methods.
- minor improvements

Added:
    jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/AclMethod.java   (with props)
    jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/DavMethod.java   (with props)
    jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/DeleteMethod.java   (with props)
    jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/PutMethod.java   (with props)
    jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/UncheckoutMethod.java   (with props)
Modified:
    jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/CheckinMethod.java
    jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/CheckoutMethod.java
    jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/CopyMethod.java
    jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/DavMethodBase.java
    jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/LabelMethod.java
    jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/LockMethod.java
    jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/MergeMethod.java
    jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/MkColMethod.java
    jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/MkWorkspaceMethod.java
    jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/MoveMethod.java
    jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/OptionsMethod.java
    jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/OrderPatchMethod.java
    jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/PropFindMethod.java
    jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/PropPatchMethod.java
    jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/ReportMethod.java
    jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/SearchMethod.java
    jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/UnLockMethod.java
    jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/UpdateMethod.java
    jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/VersionControlMethod.java

Added: jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/AclMethod.java
URL: http://svn.apache.org/viewcvs/jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/AclMethod.java?rev=397929&view=auto
==============================================================================
--- jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/AclMethod.java (added)
+++ jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/AclMethod.java Fri Apr 28 08:47:14 2006
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.webdav.client.methods;
+
+import org.apache.jackrabbit.webdav.DavServletResponse;
+import org.apache.jackrabbit.webdav.DavMethods;
+import org.apache.jackrabbit.webdav.security.AclProperty;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+
+/**
+ * <code>AclMethod</code>...
+ */
+public class AclMethod extends DavMethodBase {
+
+    private static Logger log = LoggerFactory.getLogger(AclMethod.class);
+
+    public AclMethod(String uri, AclProperty aclProperty) throws IOException {
+        super(uri);
+        setRequestBody(aclProperty);
+    }
+
+    //---------------------------------------------------------< HttpMethod >---
+    /**
+     * @return DavMethods#METHOD_ACL
+     * @see org.apache.commons.httpclient.HttpMethod#getName()
+     */
+    public String getName() {
+        return DavMethods.METHOD_ACL;
+    }
+
+    //------------------------------------------------------< DavMethodBase >---
+    /**
+     * @param statusCode
+     * @return true if status code is {@link DavServletResponse#SC_OK 200 (OK)}.
+     */
+    protected boolean isSuccess(int statusCode) {
+        return statusCode == DavServletResponse.SC_OK;
+    }
+}
\ No newline at end of file

Propchange: jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/AclMethod.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/AclMethod.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url

Modified: jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/CheckinMethod.java
URL: http://svn.apache.org/viewcvs/jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/CheckinMethod.java?rev=397929&r1=397928&r2=397929&view=diff
==============================================================================
--- jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/CheckinMethod.java (original)
+++ jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/CheckinMethod.java Fri Apr 28 08:47:14 2006
@@ -16,6 +16,7 @@
 package org.apache.jackrabbit.webdav.client.methods;
 
 import org.apache.jackrabbit.webdav.DavMethods;
+import org.apache.jackrabbit.webdav.DavServletResponse;
 import org.apache.jackrabbit.webdav.version.DeltaVConstants;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -36,10 +37,21 @@
         return getResponseHeader(DeltaVConstants.HEADER_LOCATION).getValue();
     }
 
+    //---------------------------------------------------------< HttpMethod >---
     /**
      * @see org.apache.commons.httpclient.HttpMethod#getName()
      */
     public String getName() {
         return DavMethods.METHOD_CHECKIN;
+    }
+
+    //------------------------------------------------------< DavMethodBase >---
+    /**
+     *
+     * @param statusCode
+     * @return true if status code is {@link DavServletResponse#SC_CREATED 201 (Created)}.
+     */
+    protected boolean isSuccess(int statusCode) {
+        return statusCode == DavServletResponse.SC_CREATED;
     }
 }

Modified: jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/CheckoutMethod.java
URL: http://svn.apache.org/viewcvs/jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/CheckoutMethod.java?rev=397929&r1=397928&r2=397929&view=diff
==============================================================================
--- jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/CheckoutMethod.java (original)
+++ jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/CheckoutMethod.java Fri Apr 28 08:47:14 2006
@@ -16,6 +16,7 @@
 package org.apache.jackrabbit.webdav.client.methods;
 
 import org.apache.jackrabbit.webdav.DavMethods;
+import org.apache.jackrabbit.webdav.DavServletResponse;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -31,10 +32,21 @@
         super(uri);
     }
 
+    //---------------------------------------------------------< HttpMethod >---
     /**
      * @see org.apache.commons.httpclient.HttpMethod#getName()
      */
     public String getName() {
         return DavMethods.METHOD_CHECKOUT;
+    }
+
+    //------------------------------------------------------< DavMethodBase >---
+    /**
+     *
+     * @param statusCode
+     * @return true if status code is {@link DavServletResponse#SC_OK 200 (OK)}.
+     */
+    protected boolean isSuccess(int statusCode) {
+        return statusCode == DavServletResponse.SC_OK;
     }
 }

Modified: jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/CopyMethod.java
URL: http://svn.apache.org/viewcvs/jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/CopyMethod.java?rev=397929&r1=397928&r2=397929&view=diff
==============================================================================
--- jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/CopyMethod.java (original)
+++ jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/CopyMethod.java Fri Apr 28 08:47:14 2006
@@ -17,6 +17,7 @@
 
 import org.apache.jackrabbit.webdav.DavConstants;
 import org.apache.jackrabbit.webdav.DavMethods;
+import org.apache.jackrabbit.webdav.DavServletResponse;
 import org.apache.jackrabbit.webdav.header.DepthHeader;
 import org.apache.jackrabbit.webdav.header.OverwriteHeader;
 import org.slf4j.Logger;
@@ -55,10 +56,22 @@
         }
     }
 
+    //---------------------------------------------------------< HttpMethod >---
     /**
      * @see org.apache.commons.httpclient.HttpMethod#getName()
      */
     public String getName() {
         return DavMethods.METHOD_COPY;
+    }
+
+    //------------------------------------------------------< DavMethodBase >---
+    /**
+     *
+     * @param statusCode
+     * @return true if status code is {@link DavServletResponse#SC_CREATED 201
+     * (Created)} or {@link DavServletResponse#SC_NO_CONTENT 204 (No Content)}.
+     */
+    protected boolean isSuccess(int statusCode) {
+        return statusCode == DavServletResponse.SC_CREATED || statusCode == DavServletResponse.SC_NO_CONTENT;
     }
 }

Added: jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/DavMethod.java
URL: http://svn.apache.org/viewcvs/jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/DavMethod.java?rev=397929&view=auto
==============================================================================
--- jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/DavMethod.java (added)
+++ jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/DavMethod.java Fri Apr 28 08:47:14 2006
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.webdav.client.methods;
+
+import org.apache.jackrabbit.webdav.DavException;
+import org.apache.jackrabbit.webdav.MultiStatus;
+import org.apache.jackrabbit.webdav.header.Header;
+import org.apache.commons.httpclient.HttpMethod;
+import org.w3c.dom.Document;
+
+import java.io.IOException;
+
+/**
+ * <code>DavMethod</code>...
+ */
+public interface DavMethod extends HttpMethod {
+
+    /**
+     * Adds the specified {@link Header request header}, NOT overwriting any
+     * previous value. Note that header-name matching is case insensitive.
+     *
+     * @param header
+     * @see HttpMethod#addRequestHeader(String, String)
+     */
+    public void addRequestHeader(Header header);
+
+    /**
+     * Set the specified request header, overwriting any previous value. Note
+     * that header-name matching is case-insensitive.
+     *
+     * @param header
+     * @see HttpMethod#setRequestHeader(String, String)
+     */
+    public void setRequestHeader(Header header);
+
+    /**
+     * Parse the response body into an Xml <code>Document</code>.
+     *
+     * @return Xml document or <code>null</code> if the response stream is
+     * <code>null</code>.
+     * @throws IOException If an I/O (transport) problem occurs while obtaining
+     * the response body of if the XML parsing fails.
+     * @see HttpMethod#getResponseBody()
+     * @see HttpMethod#getResponseBodyAsStream()
+     * @see HttpMethod#getResponseBodyAsString()
+     */
+    public Document getResponseBodyAsDocument() throws IOException;
+
+    /**
+     * Return the response body as <code>MultiStatus</code> object.
+     *
+     * @return
+     * @throws IOException if the response body could not be parsed
+     * @throws DavException if the status code is other than MultiStatus or if
+     * obtaining the response XML document fails
+     * @see #getResponseBodyAsDocument()
+     */
+    public MultiStatus getResponseBodyAsMultiStatus() throws IOException, DavException;
+
+    /**
+     * Builds a DavException for the status line and the DAV:error element that
+     * may be present in the response body. If the response does not indicate an
+     * error, <code>null</code> will be returned.
+     *
+     * @return DavException or <code>null</code> if this method did not result
+     * in an error.
+     * @throws IOException
+     */
+    public DavException getResponseException() throws IOException;
+
+    /**
+     * 
+     * @throws DavException
+     * @throws IOException
+     */
+    public void checkSuccess() throws DavException, IOException;
+
+    /**
+     *
+     * @return true if the method was successfully executed
+     */
+    public boolean succeeded();
+}
\ No newline at end of file

Propchange: jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/DavMethod.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/DavMethod.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url

Modified: jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/DavMethodBase.java
URL: http://svn.apache.org/viewcvs/jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/DavMethodBase.java?rev=397929&r1=397928&r2=397929&view=diff
==============================================================================
--- jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/DavMethodBase.java (original)
+++ jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/DavMethodBase.java Fri Apr 28 08:47:14 2006
@@ -16,12 +16,18 @@
 package org.apache.jackrabbit.webdav.client.methods;
 
 import org.apache.commons.httpclient.methods.EntityEnclosingMethod;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.commons.httpclient.HttpState;
+import org.apache.commons.httpclient.HttpConnection;
+import org.apache.commons.httpclient.HttpMethodBase;
+import org.apache.commons.httpclient.HttpMethod;
 import org.apache.jackrabbit.webdav.DavConstants;
 import org.apache.jackrabbit.webdav.DavException;
 import org.apache.jackrabbit.webdav.DavServletResponse;
 import org.apache.jackrabbit.webdav.MultiStatus;
 import org.apache.jackrabbit.webdav.header.Header;
 import org.apache.jackrabbit.webdav.xml.XmlSerializable;
+import org.apache.jackrabbit.webdav.xml.DomUtil;
 import org.apache.xml.serialize.OutputFormat;
 import org.apache.xml.serialize.XMLSerializer;
 import org.slf4j.Logger;
@@ -40,76 +46,70 @@
 /**
  * <code>DavMethodBase</code>...
  */
-public abstract class DavMethodBase extends EntityEnclosingMethod implements DavConstants {
+public abstract class DavMethodBase extends EntityEnclosingMethod implements DavMethod, DavConstants {
 
     private static Logger log = LoggerFactory.getLogger(DavMethodBase.class);
-    static final DocumentBuilderFactory BUILDER_FACTORY = DocumentBuilderFactory.newInstance();
-    static {
-       BUILDER_FACTORY.setNamespaceAware(true);
-    }
+
+    static final DocumentBuilderFactory BUILDER_FACTORY = DomUtil.BUILDER_FACTORY;
+
+    private boolean success;
+    private MultiStatus multiStatus;
 
     public DavMethodBase(String uri) {
 	super(uri);
     }
 
+    //---------------------------------------------------------< HttpMethod >---
     /**
+     * Reset method to 'abstract' in order to force subclasses to change the
+     * name (inherited value is {@link GetMethod#getName()}).
      *
-     * @param header
+     * @return Name of the method.
+     * @see HttpMethod#getName() 
      */
-    public void setRequestHeader(Header header) {
-        setRequestHeader(header.getHeaderName(), header.getHeaderValue());
-    }
+    public abstract String getName();
 
+    //----------------------------------------------------------< DavMethod >---
     /**
-     *
-     * @param requestBody
-     * @throws IOException
+     * @see DavMethod#addRequestHeader(Header)
      */
-    public void setRequestBody(XmlSerializable requestBody) throws IOException {
-        try {
-            ByteArrayOutputStream out = new ByteArrayOutputStream();
-            Document doc = BUILDER_FACTORY.newDocumentBuilder().newDocument();
-            doc.appendChild(requestBody.toXml(doc));
+    public void addRequestHeader(Header header) {
+        addRequestHeader(header.getHeaderName(), header.getHeaderValue());
+    }
 
-            OutputFormat format = new OutputFormat("xml", "UTF-8", true);
-            XMLSerializer serializer = new XMLSerializer(out, format);
-            serializer.setNamespaces(true);
-            serializer.asDOMSerializer().serialize(doc);
-            setRequestBody(out.toString());
-        } catch (ParserConfigurationException e) {
-            throw new IOException(e.getMessage());
-        }
+    /**
+     * @see DavMethod#setRequestHeader(Header)
+     */
+    public void setRequestHeader(Header header) {
+        setRequestHeader(header.getHeaderName(), header.getHeaderValue());
     }
 
     /**
-     * Return the response body as <code>MultiStatus</code> object.
-     *
-     * @return
-     * @throws IOException if the response body could not be parsed
-     * @throws DavException if the status code is other than MultiStatus
+     * @see DavMethod#getResponseBodyAsMultiStatus()
      */
     public MultiStatus getResponseBodyAsMultiStatus() throws IOException, DavException {
-	checkUsed();
-        if (getStatusCode() == DavServletResponse.SC_MULTI_STATUS) {
-            return MultiStatus.createFromXml(getRootElement());
+        checkUsed();
+        if (multiStatus != null) {
+            return multiStatus;
         } else {
-            throw new DavException(getStatusCode(), getName() + " resulted with unexpected status code: " + getStatusCode());
+            DavException dx = getResponseException();
+            if (dx != null) {
+                throw dx;
+            } else {
+                throw new DavException(getStatusCode(), getName() + " resulted with unexpected status: " + getStatusLine());
+            }
         }
     }
 
     /**
-     * Parse the response body into an Xml <code>Document</code>.
-     *
-     * @return Xml document or <code>null</code> if the response stream is
-     * <code>null</code>.
-     * @throws IOException if the parsing fails.
+     * @see DavMethod#getResponseBodyAsDocument()
      */
     public Document getResponseBodyAsDocument() throws IOException {
         InputStream in = getResponseBodyAsStream();
         if (in == null) {
-	    return null;
-	}
-	    try {
+            return null;
+        }
+        try {
             DocumentBuilder docBuilder = BUILDER_FACTORY.newDocumentBuilder();
             Document document = docBuilder.parse(in);
             return document;
@@ -117,11 +117,11 @@
             throw new IOException(e.getMessage());
         } catch (SAXException e) {
             throw new IOException(e.getMessage());
-	    }
-	}
+        }
+    }
 
     /**
-     * 
+     *
      * @return
      * @throws IOException
      */
@@ -129,25 +129,152 @@
         Document document = getResponseBodyAsDocument();
         if (document != null) {
             return document.getDocumentElement();
-    }
+        }
         return null;
     }
 
     /**
-     *
-     * @return
-     * @throws IOException
+     * @see DavMethod#getResponseException()
      */
     public DavException getResponseException() throws IOException {
+	checkUsed();
+	if (success) {
+            String msg = "Cannot retrieve exception from successful response.";
+	    log.warn(msg);
+	    throw new IllegalStateException(msg);
+	}
+
+        Element responseRoot = getRootElement();
+        if (responseRoot != null) {
+            return new DavException(getStatusCode(), getStatusText(), null, responseRoot);
+        } else {           
+            // fallback: no or unparsable response body
+            return new DavException(getStatusCode(), getStatusText());
+        }
+    }
+
+    /**
+     * @see DavMethod#checkSuccess()
+     */
+    public void checkSuccess() throws DavException, IOException {
+        if (!succeeded()) {
+            throw getResponseException();
+        }
+    }
+
+    /**
+     * @see DavMethod#succeeded()
+     */
+    public boolean succeeded() {
         checkUsed();
-	if (getStatusCode() < DavServletResponse.SC_BAD_REQUEST) {
-	    log.warn("Cannot retrieve exception from successful response.");
-                return null;
-            }
+        return success;
+    }
 
-        // todo: build exception from response body if present.
+    //--------------------------------------------------------------------------
+    /**
+     *
+     * @param requestBody
+     * @throws IOException
+     */
+    public void setRequestBody(Document requestBody) throws IOException {
+        ByteArrayOutputStream out = new ByteArrayOutputStream();
+        OutputFormat format = new OutputFormat("xml", "UTF-8", false);
+        XMLSerializer serializer = new XMLSerializer(out, format);
+        serializer.setNamespaces(true);
+        serializer.asDOMSerializer().serialize(requestBody);
+        setRequestBody(out.toString());
+    }
 
-	// fallback: no or unparsable response body
-	return new DavException(getStatusCode(), getStatusText());
+    /**
+     *
+     * @param requestBody
+     * @throws IOException
+     */
+    public void setRequestBody(XmlSerializable requestBody) throws IOException {
+        try {
+            Document doc = BUILDER_FACTORY.newDocumentBuilder().newDocument();
+            doc.appendChild(requestBody.toXml(doc));
+            setRequestBody(doc);
+        } catch (ParserConfigurationException e) {
+            throw new IOException(e.getMessage());
+        }
+    }
+
+    /**
+     *
+     * @param statusCode
+     * @return
+     */
+    abstract protected boolean isSuccess(int statusCode);
+
+    /**
+     *
+     * @param success
+     */
+    protected void setSuccess(boolean success) {
+        this.success = success;
+    }
+
+    /**
+     *
+     * @return
+     */
+    protected boolean getSuccess() {
+        return success;
+    }
+
+    /**
+     * This method is invoked during the {@link #processResponseBody(HttpState, HttpConnection)},
+     * which in this implementation parses the response body into a <code>MultiStatus</code>
+     * object if the status code indicates 207 (MultiStatus).<br>
+     * Subclasses may want to override this method in order to apply specific
+     * validation of the multi-status.<p/>
+     * This implementation does nothing.
+     *
+     * @param multiStatus
+     * @param httpState
+     * @param httpConnection
+     * @see #processResponseBody(HttpState, HttpConnection)
+     */
+    protected void processMultiStatusBody(MultiStatus multiStatus, HttpState httpState, HttpConnection httpConnection) {
+        // does nothing
+    }
+
+    //-----------------------------------------------------< HttpMethodBase >---
+    /**
+     *
+     * @param httpState
+     * @param httpConnection
+     */
+    protected void processStatusLine(HttpState httpState, HttpConnection httpConnection) {
+        super.processStatusLine(httpState, httpConnection);
+        int code = getStatusCode();
+        // default
+        success = code < DavServletResponse.SC_BAD_REQUEST;
+        // sub classes overwrites
+        success = isSuccess(code);
+    }
+
+    /**
+     * In case of a MultiStatus response code, this method parses the response
+     * body and resets the 'success' flag depending on the multistatus content,
+     * which could indicate method failure as well.
+     *
+     * @param httpState
+     * @param httpConnection
+     * @see HttpMethodBase#processResponseBody(HttpState, HttpConnection)
+     */
+    protected final void processResponseBody(HttpState httpState, HttpConnection httpConnection) {
+        // in case of multi-status response
+        if (getStatusCode() == DavServletResponse.SC_MULTI_STATUS) {
+            try {
+                multiStatus = MultiStatus.createFromXml(getRootElement());
+                // sub-class processing/validation of the multiStatus
+                processMultiStatusBody(multiStatus, httpState, httpConnection);
+            } catch (IOException e) {
+                log.error("Error while parsing multistatus response: " + e);
+                success = false;
+            }
+        }
     }
 }

Added: jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/DeleteMethod.java
URL: http://svn.apache.org/viewcvs/jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/DeleteMethod.java?rev=397929&view=auto
==============================================================================
--- jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/DeleteMethod.java (added)
+++ jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/DeleteMethod.java Fri Apr 28 08:47:14 2006
@@ -0,0 +1,41 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.jackrabbit.webdav.client.methods;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.jackrabbit.webdav.DavMethods;
+import org.apache.jackrabbit.webdav.DavServletResponse;
+
+/**
+ * <code>DeleteMethod</code>...
+ */
+public class DeleteMethod extends DavMethodBase {
+
+    private static Logger log = LoggerFactory.getLogger(DeleteMethod.class);
+
+    public DeleteMethod(String uri) {
+        super(uri);
+    }
+
+    public String getName() {
+        return DavMethods.METHOD_DELETE;
+    }
+
+    protected boolean isSuccess(int statusCode) {
+        return statusCode == DavServletResponse.SC_OK;
+    }
+}
\ No newline at end of file

Propchange: jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/DeleteMethod.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/DeleteMethod.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url

Modified: jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/LabelMethod.java
URL: http://svn.apache.org/viewcvs/jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/LabelMethod.java?rev=397929&r1=397928&r2=397929&view=diff
==============================================================================
--- jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/LabelMethod.java (original)
+++ jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/LabelMethod.java Fri Apr 28 08:47:14 2006
@@ -16,6 +16,7 @@
 package org.apache.jackrabbit.webdav.client.methods;
 
 import org.apache.jackrabbit.webdav.DavMethods;
+import org.apache.jackrabbit.webdav.DavServletResponse;
 import org.apache.jackrabbit.webdav.header.DepthHeader;
 import org.apache.jackrabbit.webdav.version.LabelInfo;
 import org.slf4j.Logger;
@@ -66,10 +67,21 @@
         setRequestBody(labelInfo);
     }
 
+    //---------------------------------------------------------< HttpMethod >---
     /**
      * @see org.apache.commons.httpclient.HttpMethod#getName()
      */
     public String getName() {
         return DavMethods.METHOD_LABEL;
+    }
+
+    //------------------------------------------------------< DavMethodBase >---
+    /**
+     *
+     * @param statusCode
+     * @return true if status code is {@link DavServletResponse#SC_OK 200 (OK)}.
+     */
+    protected boolean isSuccess(int statusCode) {
+        return statusCode == DavServletResponse.SC_OK;
     }
 }

Modified: jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/LockMethod.java
URL: http://svn.apache.org/viewcvs/jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/LockMethod.java?rev=397929&r1=397928&r2=397929&view=diff
==============================================================================
--- jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/LockMethod.java (original)
+++ jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/LockMethod.java Fri Apr 28 08:47:14 2006
@@ -18,6 +18,7 @@
 import org.apache.jackrabbit.webdav.DavConstants;
 import org.apache.jackrabbit.webdav.DavMethods;
 import org.apache.jackrabbit.webdav.header.CodedUrlHeader;
+import org.apache.jackrabbit.webdav.DavServletResponse;
 import org.apache.jackrabbit.webdav.header.DepthHeader;
 import org.apache.jackrabbit.webdav.header.IfHeader;
 import org.apache.jackrabbit.webdav.header.TimeoutHeader;
@@ -88,13 +89,6 @@
         setRequestHeader(ifh);
     }
 
-    /**
-     * @see org.apache.commons.httpclient.HttpMethod#getName()
-     */
-    public String getName() {
-        return DavMethods.METHOD_LOCK;
-    }
-
     public ActiveLock getResponseAsLock() throws IOException {
         checkUsed();
         // todo -> build lockdiscovery-prop -> retrieve activelock
@@ -105,5 +99,23 @@
         checkUsed();
         CodedUrlHeader cuh = new CodedUrlHeader(DavConstants.HEADER_LOCK_TOKEN, getResponseHeader(DavConstants.HEADER_LOCK_TOKEN).getValue());
         return cuh.getCodedUrl();
+    }
+
+    //---------------------------------------------------------< HttpMethod >---
+    /**
+     * @see org.apache.commons.httpclient.HttpMethod#getName()
+     */
+    public String getName() {
+        return DavMethods.METHOD_LOCK;
+    }
+
+    //------------------------------------------------------< DavMethodBase >---
+    /**
+     *
+     * @param statusCode
+     * @return true if status code is {@link DavServletResponse#SC_OK 200 (OK)}.
+     */
+    protected boolean isSuccess(int statusCode) {
+        return statusCode == DavServletResponse.SC_OK;
     }
 }

Modified: jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/MergeMethod.java
URL: http://svn.apache.org/viewcvs/jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/MergeMethod.java?rev=397929&r1=397928&r2=397929&view=diff
==============================================================================
--- jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/MergeMethod.java (original)
+++ jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/MergeMethod.java Fri Apr 28 08:47:14 2006
@@ -16,6 +16,7 @@
 package org.apache.jackrabbit.webdav.client.methods;
 
 import org.apache.jackrabbit.webdav.DavMethods;
+import org.apache.jackrabbit.webdav.DavServletResponse;
 import org.apache.jackrabbit.webdav.version.MergeInfo;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -34,10 +35,21 @@
         setRequestBody(mergeInfo);
     }
 
+    //---------------------------------------------------------< HttpMethod >---
     /**
      * @see org.apache.commons.httpclient.HttpMethod#getName()
      */
     public String getName() {
         return DavMethods.METHOD_MERGE;
+    }
+
+    //------------------------------------------------------< DavMethodBase >---
+    /**
+     *
+     * @param statusCode
+     * @return true if status code is {@link DavServletResponse#SC_MULTI_STATUS 207 (Multi-Status)}.
+     */
+    protected boolean isSuccess(int statusCode) {
+        return statusCode == DavServletResponse.SC_MULTI_STATUS;
     }
 }

Modified: jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/MkColMethod.java
URL: http://svn.apache.org/viewcvs/jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/MkColMethod.java?rev=397929&r1=397928&r2=397929&view=diff
==============================================================================
--- jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/MkColMethod.java (original)
+++ jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/MkColMethod.java Fri Apr 28 08:47:14 2006
@@ -16,6 +16,7 @@
 package org.apache.jackrabbit.webdav.client.methods;
 
 import org.apache.jackrabbit.webdav.DavMethods;
+import org.apache.jackrabbit.webdav.DavServletResponse;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -30,10 +31,21 @@
         super(uri);
     }
 
+    //---------------------------------------------------------< HttpMethod >---
     /**
      * @see org.apache.commons.httpclient.HttpMethod#getName()
      */
     public String getName() {
         return DavMethods.METHOD_MKCOL;
+    }
+
+    //------------------------------------------------------< DavMethodBase >---
+    /**
+     *
+     * @param statusCode
+     * @return true if status code is {@link DavServletResponse#SC_CREATED 201 (Created)}.
+     */
+    protected boolean isSuccess(int statusCode) {
+        return statusCode == DavServletResponse.SC_CREATED;
     }
 }

Modified: jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/MkWorkspaceMethod.java
URL: http://svn.apache.org/viewcvs/jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/MkWorkspaceMethod.java?rev=397929&r1=397928&r2=397929&view=diff
==============================================================================
--- jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/MkWorkspaceMethod.java (original)
+++ jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/MkWorkspaceMethod.java Fri Apr 28 08:47:14 2006
@@ -16,6 +16,7 @@
 package org.apache.jackrabbit.webdav.client.methods;
 
 import org.apache.jackrabbit.webdav.DavMethods;
+import org.apache.jackrabbit.webdav.DavServletResponse;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -30,10 +31,21 @@
         super(uri);
     }
 
+    //---------------------------------------------------------< HttpMethod >---
     /**
      * @see org.apache.commons.httpclient.HttpMethod#getName()
      */
     public String getName() {
         return DavMethods.METHOD_MKWORKSPACE;
+    }
+
+    //------------------------------------------------------< DavMethodBase >---
+    /**
+     *
+     * @param statusCode
+     * @return true if status code is {@link DavServletResponse#SC_CREATED 201 (Created)}.
+     */
+    protected boolean isSuccess(int statusCode) {
+        return statusCode == DavServletResponse.SC_CREATED;
     }
 }

Modified: jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/MoveMethod.java
URL: http://svn.apache.org/viewcvs/jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/MoveMethod.java?rev=397929&r1=397928&r2=397929&view=diff
==============================================================================
--- jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/MoveMethod.java (original)
+++ jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/MoveMethod.java Fri Apr 28 08:47:14 2006
@@ -17,6 +17,7 @@
 
 import org.apache.jackrabbit.webdav.DavConstants;
 import org.apache.jackrabbit.webdav.DavMethods;
+import org.apache.jackrabbit.webdav.DavServletResponse;
 import org.apache.jackrabbit.webdav.header.OverwriteHeader;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -34,10 +35,22 @@
         setRequestHeader(new OverwriteHeader(overwrite));
     }
 
+    //---------------------------------------------------------< HttpMethod >---
     /**
      * @see org.apache.commons.httpclient.HttpMethod#getName()
      */
     public String getName() {
         return DavMethods.METHOD_MOVE;
+    }
+
+    //------------------------------------------------------< DavMethodBase >---
+    /**
+     *
+     * @param statusCode
+     * @return true if status code is {@link DavServletResponse#SC_CREATED 201
+     * (Created)} or {@link DavServletResponse#SC_NO_CONTENT 204 (No Content)}.
+     */
+    protected boolean isSuccess(int statusCode) {
+        return statusCode == DavServletResponse.SC_CREATED || statusCode == DavServletResponse.SC_NO_CONTENT;
     }
 }

Modified: jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/OptionsMethod.java
URL: http://svn.apache.org/viewcvs/jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/OptionsMethod.java?rev=397929&r1=397928&r2=397929&view=diff
==============================================================================
--- jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/OptionsMethod.java (original)
+++ jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/OptionsMethod.java Fri Apr 28 08:47:14 2006
@@ -17,13 +17,19 @@
 
 import org.apache.jackrabbit.webdav.DavConstants;
 import org.apache.jackrabbit.webdav.DavMethods;
+import org.apache.jackrabbit.webdav.DavServletResponse;
 import org.apache.jackrabbit.webdav.version.OptionsInfo;
 import org.apache.jackrabbit.webdav.version.OptionsResponse;
+import org.apache.commons.httpclient.HttpConnection;
+import org.apache.commons.httpclient.HttpState;
+import org.apache.commons.httpclient.Header;
+import org.apache.commons.httpclient.HttpMethodBase;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.w3c.dom.Element;
 
 import java.io.IOException;
+import java.util.HashSet;
 
 /**
  * <code>OptionsMethod</code>...
@@ -32,6 +38,8 @@
 
     private static Logger log = LoggerFactory.getLogger(OptionsMethod.class);
 
+    private final HashSet allowedMethods = new HashSet();
+
     public OptionsMethod(String uri) {
 	super(uri);
     }
@@ -49,13 +57,6 @@
     }
 
     /**
-     * @see org.apache.commons.httpclient.HttpMethod#getName()
-     */
-    public String getName() {
-	return DavMethods.METHOD_OPTIONS;
-    }
-
-    /**
      *
      * @return
      * @throws IOException
@@ -68,5 +69,69 @@
             or = OptionsResponse.createFromXml(rBody);
         }
         return or;
+    }
+
+    /**
+     * Checks if the specified method is a supported method by the resource
+     * identified by the original URI.
+     *
+     * @param method
+     * @return true if the given method is contained in the 'Allow' response header.
+     */
+    public boolean isAllowed(String method) {
+        checkUsed();
+        return allowedMethods.contains(method.toUpperCase());
+    }
+
+
+    /**
+     * Returns an array of String listing the allowed methods.
+     *
+     * @return all methods allowed on the resource specified by the original URI.
+     */
+    public String[] getAllowedMethods() {
+        checkUsed();
+        return (String[]) allowedMethods.toArray(new String[allowedMethods.size()]);
+    }
+
+
+    //---------------------------------------------------------< HttpMethod >---
+    /**
+     * @see org.apache.commons.httpclient.HttpMethod#getName()
+     */
+    public String getName() {
+        return DavMethods.METHOD_OPTIONS;
+    }
+
+    //-----------------------------------------------------< HttpMethodBase >---
+    /**
+     * <p>
+     * This implementation will parse the <tt>Allow</tt> header to obtain
+     * the set of methods supported by the resource identified by the Request-URI.
+     * </p>
+     *
+     * @param state the {@link HttpState state} information associated with this method
+     * @param conn the {@link HttpConnection connection} used to execute
+     *        this HTTP method
+     * @see HttpMethodBase#processResponseHeaders(HttpState, HttpConnection)
+     */
+    protected void processResponseHeaders(HttpState state, HttpConnection conn) {
+        Header allow = getResponseHeader("Allow");
+        if (allow != null) {
+            String[] methods = allow.getValue().split(",");
+            for (int i = 0; i < methods.length; i++) {
+                allowedMethods.add(methods[i].trim().toUpperCase());
+            }
+        }
+    }
+
+    //------------------------------------------------------< DavMethodBase >---
+    /**
+     *
+     * @param statusCode
+     * @return true if status code is {@link DavServletResponse#SC_OK 200 (OK)}.
+     */
+    protected boolean isSuccess(int statusCode) {
+        return statusCode == DavServletResponse.SC_OK;
     }
 }

Modified: jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/OrderPatchMethod.java
URL: http://svn.apache.org/viewcvs/jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/OrderPatchMethod.java?rev=397929&r1=397928&r2=397929&view=diff
==============================================================================
--- jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/OrderPatchMethod.java (original)
+++ jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/OrderPatchMethod.java Fri Apr 28 08:47:14 2006
@@ -17,6 +17,7 @@
 
 import org.apache.jackrabbit.webdav.DavConstants;
 import org.apache.jackrabbit.webdav.DavMethods;
+import org.apache.jackrabbit.webdav.DavServletResponse;
 import org.apache.jackrabbit.webdav.ordering.OrderPatch;
 import org.apache.jackrabbit.webdav.ordering.OrderingConstants;
 import org.apache.jackrabbit.webdav.ordering.Position;
@@ -53,15 +54,15 @@
      * that reorders multiple members at once.
      *
      * @param uri
-     * @param orderingHref
+     * @param orderingType href String identifying the ordering type
      * @param memberSegment
      * @param first
      */
-    public OrderPatchMethod(String uri, String orderingHref, String memberSegment, boolean first) throws IOException {
+    public OrderPatchMethod(String uri, String orderingType, String memberSegment, boolean first) throws IOException {
         super(uri);
-        String orderType = (first) ? OrderingConstants.XML_FIRST : OrderingConstants.XML_LAST;
-        Position p = new Position(orderType);
-        OrderPatch op = new OrderPatch(orderingHref, new OrderPatch.Member(memberSegment, p));
+        String orderPosition = (first) ? OrderingConstants.XML_FIRST : OrderingConstants.XML_LAST;
+        Position p = new Position(orderPosition);
+        OrderPatch op = new OrderPatch(orderingType, new OrderPatch.Member(memberSegment, p));
         setRequestHeader(DavConstants.HEADER_CONTENT_TYPE, "text/xml; charset=UTF-8");
         setRequestBody(op);
     }
@@ -74,24 +75,35 @@
      * that reorders multiple members at once.
      *
      * @param uri
-     * @param orderingHref
+     * @param orderingType href String identifying the ordering type
      * @param memberSegment
      * @param targetMemberSegmet
-     * @param above
+     * @param before
      */
-    public OrderPatchMethod(String uri, String orderingHref, String memberSegment, String targetMemberSegmet, boolean above) throws IOException {
+    public OrderPatchMethod(String uri, String orderingType, String memberSegment, String targetMemberSegmet, boolean before) throws IOException {
         super(uri);
-        String orderType = (above) ? OrderingConstants.XML_AFTER : OrderingConstants.XML_BEFORE;
-        Position p = new Position(orderType, targetMemberSegmet);
-        OrderPatch op = new OrderPatch(orderingHref, new OrderPatch.Member(memberSegment, p));
+        String orderPosition = (before) ? OrderingConstants.XML_BEFORE : OrderingConstants.XML_AFTER;
+        Position p = new Position(orderPosition, targetMemberSegmet);
+        OrderPatch op = new OrderPatch(orderingType, new OrderPatch.Member(memberSegment, p));
         setRequestHeader(DavConstants.HEADER_CONTENT_TYPE, "text/xml; charset=UTF-8");
         setRequestBody(op);
     }
 
+    //---------------------------------------------------------< HttpMethod >---
     /**
      * @see org.apache.commons.httpclient.HttpMethod#getName()
      */
     public String getName() {
         return DavMethods.METHOD_ORDERPATCH;
+    }
+
+    //------------------------------------------------------< DavMethodBase >---
+    /**
+     *
+     * @param statusCode
+     * @return true if status code is {@link DavServletResponse#SC_OK 200 (OK)}.
+     */
+    protected boolean isSuccess(int statusCode) {
+        return statusCode == DavServletResponse.SC_OK;
     }
 }

Modified: jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/PropFindMethod.java
URL: http://svn.apache.org/viewcvs/jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/PropFindMethod.java?rev=397929&r1=397928&r2=397929&view=diff
==============================================================================
--- jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/PropFindMethod.java (original)
+++ jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/PropFindMethod.java Fri Apr 28 08:47:14 2006
@@ -17,18 +17,16 @@
 
 import org.apache.jackrabbit.webdav.DavConstants;
 import org.apache.jackrabbit.webdav.DavMethods;
+import org.apache.jackrabbit.webdav.DavServletResponse;
 import org.apache.jackrabbit.webdav.header.DepthHeader;
 import org.apache.jackrabbit.webdav.property.DavPropertyNameSet;
 import org.apache.jackrabbit.webdav.xml.DomUtil;
-import org.apache.xml.serialize.OutputFormat;
-import org.apache.xml.serialize.XMLSerializer;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
 import javax.xml.parsers.ParserConfigurationException;
-import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 
 /**
@@ -60,7 +58,7 @@
         setRequestHeader(dh.getHeaderName(), dh.getHeaderValue());
 
         setRequestHeader(DavConstants.HEADER_CONTENT_TYPE, "text/xml; charset=UTF-8");
-
+        
         // build the request body
         try {
             // create the document and attach the root element
@@ -69,39 +67,44 @@
             document.appendChild(propfind);
 
             // fill the propfind element
-        switch (propfindType) {
-            case PROPFIND_ALL_PROP:
+            switch (propfindType) {
+                case PROPFIND_ALL_PROP:
                     propfind.appendChild(DomUtil.createElement(document, XML_ALLPROP, NAMESPACE));
-                break;
-            case PROPFIND_PROPERTY_NAMES:
+                    break;
+                case PROPFIND_PROPERTY_NAMES:
                     propfind.appendChild(DomUtil.createElement(document, XML_PROPNAME, NAMESPACE));
-                break;
-            default:
-                if (propNameSet == null) {
+                    break;
+                default:
+                    if (propNameSet == null) {
                         propfind.appendChild(DomUtil.createElement(document, XML_PROP, NAMESPACE));
-                } else {
+                    } else {
                         propfind.appendChild(propNameSet.toXml(document));
-                }
-                break;
-        }
+                    }
+                    break;
+            }
 
             // set the request body
-            ByteArrayOutputStream out = new ByteArrayOutputStream();
-            OutputFormat format = new OutputFormat("xml", "UTF-8", true);
-            XMLSerializer serializer = new XMLSerializer(out, format);
-            serializer.setNamespaces(true);
-            serializer.asDOMSerializer().serialize(document);
-            setRequestBody(out.toString());
-
+            setRequestBody(document);
         } catch (ParserConfigurationException e) {
             throw new IOException(e.getMessage());
         }
     }
 
+    //---------------------------------------------------------< HttpMethod >---
     /**
      * @see org.apache.commons.httpclient.HttpMethod#getName()
      */
     public String getName() {
         return DavMethods.METHOD_PROPFIND;
+    }
+
+    //------------------------------------------------------< DavMethodBase >---
+    /**
+     *
+     * @param statusCode
+     * @return true if status code is {@link DavServletResponse#SC_MULTI_STATUS 207 (Multi-Status)}.
+     */
+    protected boolean isSuccess(int statusCode) {
+        return statusCode == DavServletResponse.SC_MULTI_STATUS;
     }
 }

Modified: jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/PropPatchMethod.java
URL: http://svn.apache.org/viewcvs/jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/PropPatchMethod.java?rev=397929&r1=397928&r2=397929&view=diff
==============================================================================
--- jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/PropPatchMethod.java (original)
+++ jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/PropPatchMethod.java Fri Apr 28 08:47:14 2006
@@ -19,17 +19,26 @@
 import org.apache.jackrabbit.webdav.DavMethods;
 import org.apache.jackrabbit.webdav.property.DavPropertyNameSet;
 import org.apache.jackrabbit.webdav.property.DavPropertySet;
+import org.apache.jackrabbit.webdav.property.DavPropertyName;
+import org.apache.jackrabbit.webdav.property.DavPropertyNameIterator;
+import org.apache.jackrabbit.webdav.property.DavProperty;
+import org.apache.jackrabbit.webdav.DavServletResponse;
+import org.apache.jackrabbit.webdav.MultiStatus;
+import org.apache.jackrabbit.webdav.MultiStatusResponse;
+import org.apache.jackrabbit.webdav.DavException;
+import org.apache.jackrabbit.webdav.Status;
 import org.apache.jackrabbit.webdav.xml.DomUtil;
-import org.apache.xml.serialize.OutputFormat;
-import org.apache.xml.serialize.XMLSerializer;
+import org.apache.commons.httpclient.HttpState;
+import org.apache.commons.httpclient.HttpConnection;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
 import javax.xml.parsers.ParserConfigurationException;
-import java.io.ByteArrayOutputStream;
 import java.io.IOException;
+import java.util.List;
+import java.util.Iterator;
 
 /**
  * <code>PropPatchMethod</code>...
@@ -38,42 +47,187 @@
 
     private static Logger log = LoggerFactory.getLogger(PropPatchMethod.class);
 
+    private final DavPropertyNameSet propertyNames = new DavPropertyNameSet();
+
+    private DavException responseException;
+
+    /**
+     *
+     * @param uri
+     * @param changeList list of DavProperty (for 'set') and DavPropertyName
+     * (for 'remove') entries.
+     * @throws IOException
+     */
+    public PropPatchMethod(String uri, List changeList) throws IOException {
+        super(uri);
+        if (changeList == null || changeList.isEmpty()) {
+            throw new IllegalArgumentException("PROPPATCH cannot be executed without properties to be set or removed.");
+        }
+        try {
+            Document document = BUILDER_FACTORY.newDocumentBuilder().newDocument();
+            Element propUpdateElement = DomUtil.addChildElement(document, XML_PROPERTYUPDATE, NAMESPACE);
+
+            Element propElement = null;
+            boolean isSet = false;
+            Iterator it = changeList.iterator();
+            while (it.hasNext()) {
+                Object entry = it.next();
+                if (entry instanceof DavPropertyName) {
+                    // DAV:remove
+                    DavPropertyName removeName = (DavPropertyName)entry;
+                    if (propElement == null || isSet) {
+                        isSet = false;
+                        propElement = getPropElement(propUpdateElement, isSet);
+                    }
+                    propElement.appendChild(removeName.toXml(document));
+                    propertyNames.add(removeName);
+                } else if (entry instanceof DavProperty) {
+                    // DAV:set
+                    DavProperty setProperty = (DavProperty)entry;
+                    if (propElement == null || !isSet) {
+                        isSet = true;
+                        propElement = getPropElement(propUpdateElement, isSet);
+                    }
+                    propElement.appendChild(setProperty.toXml(document));
+                    propertyNames.add(setProperty.getName());
+                } else {
+                    throw new IllegalArgumentException("ChangeList may only contain DavPropertyName and DavProperty elements.");
+                }
+            }
+            setRequestBody(document);
+        } catch (ParserConfigurationException e) {
+            throw new IOException(e.getMessage());
+        }
+    }
+
     public PropPatchMethod(String uri, DavPropertySet setProperties,
                            DavPropertyNameSet removeProperties) throws IOException {
         super(uri);
         if (setProperties == null || removeProperties == null) {
             throw new IllegalArgumentException("Neither setProperties nor removeProperties must be null.");
         }
+        if (setProperties.isEmpty() && removeProperties.isEmpty()) {
+            throw new IllegalArgumentException("Either setProperties or removeProperties can be empty; not both of them.");
+        }
+
+        propertyNames.addAll(removeProperties);
+        DavPropertyName[] setNames = setProperties.getPropertyNames();
+        for (int i = 0; i < setNames.length; i++) {
+            propertyNames.add(setNames[i]);
+        }
 
         try {
             Document document = BUILDER_FACTORY.newDocumentBuilder().newDocument();
-            Element propupdate = DomUtil.createElement(document, XML_PROPERTYUPDATE, NAMESPACE);
+            Element propupdate = DomUtil.addChildElement(document, XML_PROPERTYUPDATE, NAMESPACE);
             // DAV:set
-            Element set = DomUtil.createElement(document, XML_SET, NAMESPACE);
-            set.appendChild(setProperties.toXml(document));
+            if (!setProperties.isEmpty()) {
+                Element set = DomUtil.addChildElement(propupdate, XML_SET, NAMESPACE);
+                set.appendChild(setProperties.toXml(document));
+            }
             // DAV:remove
-            Element remove = DomUtil.createElement(document, XML_REMOVE, NAMESPACE);
-            remove.appendChild(removeProperties.toXml(document));
-
-            propupdate.appendChild(set);
-            propupdate.appendChild(remove);
-            document.appendChild(propupdate);
-
-            ByteArrayOutputStream out = new ByteArrayOutputStream();
-            OutputFormat format = new OutputFormat("xml", "UTF-8", true);
-            XMLSerializer serializer = new XMLSerializer(out, format);
-            serializer.setNamespaces(true);
-            serializer.asDOMSerializer().serialize(document);
-            setRequestBody(out.toString());
+            if (!removeProperties.isEmpty()) {
+                Element remove = DomUtil.addChildElement(propupdate, XML_REMOVE, NAMESPACE);
+                remove.appendChild(removeProperties.toXml(document));
+            }
+            setRequestBody(document);
         } catch (ParserConfigurationException e) {
             throw new IOException(e.getMessage());
         }
     }
 
+    private Element getPropElement(Element propUpdate, boolean isSet) {
+        Element updateEntry = DomUtil.addChildElement(propUpdate, (isSet) ? XML_SET : XML_REMOVE , NAMESPACE);
+        return DomUtil.addChildElement(updateEntry, XML_PROP, NAMESPACE);
+    }
+
+    //---------------------------------------------------------< HttpMethod >---
     /**
      * @see org.apache.commons.httpclient.HttpMethod#getName()
      */
     public String getName() {
         return DavMethods.METHOD_PROPPATCH;
+    }
+
+    //------------------------------------------------------< DavMethodBase >---
+    /**
+     *
+     * @param statusCode
+     * @return true if status code is {@link DavServletResponse#SC_MULTI_STATUS 207 (Multi-Status)}.
+     * For compliance reason {@link DavServletResponse#SC_OK 200 (OK)} is
+     * interpreted as successful response as well.
+     */
+    protected boolean isSuccess(int statusCode) {
+        return statusCode == DavServletResponse.SC_MULTI_STATUS || statusCode == DavServletResponse.SC_OK;
+    }
+
+    /**
+     * 
+     * @param multiStatus
+     * @param httpState
+     * @param httpConnection
+     */
+    protected void processMultiStatusBody(MultiStatus multiStatus, HttpState httpState, HttpConnection httpConnection) {
+        // check of OK response contains all set/remove properties
+        MultiStatusResponse[] resp = multiStatus.getResponses();
+        if (resp.length != 1) {
+            log.warn("Expected a single multi-status response in PROPPATCH.");
+        }
+        boolean success = true;
+        // only check the first ms-response
+        for (int i = 0; i < 1; i++) {
+            DavPropertyNameSet okSet = resp[i].getPropertyNames(DavServletResponse.SC_OK);
+            if (okSet.isEmpty()) {
+                log.debug("PROPPATCH failed: No 'OK' response found for resource " + resp[i].getHref());
+                success = false;
+            } else {
+                DavPropertyNameIterator it = propertyNames.iterator();
+                while (it.hasNext()) {
+                    DavPropertyName pn = it.nextPropertyName();
+                    success = okSet.remove(pn);
+                }
+            }
+            if (!okSet.isEmpty()) {
+                StringBuffer b = new StringBuffer("The following properties outside of the original request where set or removed: ");
+                DavPropertyNameIterator it = okSet.iterator();
+                while (it.hasNext()) {
+                    b.append(it.nextPropertyName().toString()).append("; ");
+                }
+                log.warn(b.toString());
+            }
+        }
+        // if  build the error message
+        if (!success) {
+            Status[] st = resp[0].getStatus();
+            // TODO: respect multiple error reasons (not only the first one)
+            for (int i = 0; i < st.length && responseException == null; i ++) {
+                switch (st[i].getStatusCode()) {
+                    case DavServletResponse.SC_FAILED_DEPENDENCY:
+                        // ignore
+                        break;
+                    default:
+                        responseException = new DavException(st[i].getStatusCode());
+                }
+            }
+        }
+    }
+
+    /**
+     *
+     * @return
+     * @throws IOException
+     * @see DavMethod#getResponseException() 
+     */
+    public DavException getResponseException() throws IOException {
+        checkUsed();
+        if (getSuccess()) {
+            String msg = "Cannot retrieve exception from successful response.";
+            log.warn(msg);
+            throw new IllegalStateException(msg);
+        }
+        if (responseException != null) {
+            return responseException;
+        } else {
+            return super.getResponseException();
+        }
     }
 }

Added: jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/PutMethod.java
URL: http://svn.apache.org/viewcvs/jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/PutMethod.java?rev=397929&view=auto
==============================================================================
--- jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/PutMethod.java (added)
+++ jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/PutMethod.java Fri Apr 28 08:47:14 2006
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.webdav.client.methods;
+
+import org.apache.jackrabbit.webdav.DavServletResponse;
+import org.apache.jackrabbit.webdav.DavMethods;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * <code>PutMethod</code>...
+ */
+public class PutMethod extends DavMethodBase {
+
+    private static Logger log = LoggerFactory.getLogger(PutMethod.class);
+
+    public PutMethod(String uri) {
+        super(uri);
+    }
+
+    //---------------------------------------------------------< HttpMethod >---
+    /**
+     * @see org.apache.commons.httpclient.HttpMethod#getName()
+     */
+    public String getName() {
+        return DavMethods.METHOD_PUT;
+    }
+
+    //------------------------------------------------------< DavMethodBase >---
+    /**
+     * @param statusCode
+     * @return true if the status code is either {@link DavServletResponse#SC_CREATED 200 (OK)}
+     * or {@link DavServletResponse#SC_NO_CONTENT 204 (No Content)}.
+     * @see DavMethodBase#isSuccess(int)
+     */
+    protected boolean isSuccess(int statusCode) {
+        return statusCode == DavServletResponse.SC_CREATED || statusCode == DavServletResponse.SC_NO_CONTENT;
+    }
+}
\ No newline at end of file

Propchange: jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/PutMethod.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/PutMethod.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url

Modified: jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/ReportMethod.java
URL: http://svn.apache.org/viewcvs/jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/ReportMethod.java?rev=397929&r1=397928&r2=397929&view=diff
==============================================================================
--- jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/ReportMethod.java (original)
+++ jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/ReportMethod.java Fri Apr 28 08:47:14 2006
@@ -21,6 +21,7 @@
 import org.apache.jackrabbit.webdav.version.report.ReportInfo;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.apache.jackrabbit.webdav.DavServletResponse;
 
 import java.io.IOException;
 
@@ -31,19 +32,41 @@
 
     private static Logger log = LoggerFactory.getLogger(ReportMethod.class);
 
+    private final boolean isDeep;
+
     public ReportMethod(String uri, ReportInfo reportInfo) throws IOException {
 	super(uri);
 	DepthHeader dh = new DepthHeader(reportInfo.getDepth());
+        isDeep = reportInfo.getDepth() > DavConstants.DEPTH_0;
+
 	setRequestHeader(dh);
 
         setRequestHeader(DavConstants.HEADER_CONTENT_TYPE, "text/xml; charset=UTF-8");
        	setRequestBody(reportInfo);
     }
 
+    //---------------------------------------------------------< HttpMethod >---
     /**
      * @see org.apache.commons.httpclient.HttpMethod#getName()
      */
     public String getName() {
 	return DavMethods.METHOD_REPORT;
+    }
+
+    //------------------------------------------------------< DavMethodBase >---
+    /**
+     *
+     * @param statusCode
+     * @return true if status code is {@link DavServletResponse#SC_OK 200 (OK)}
+     * or {@link DavServletResponse#SC_MULTI_STATUS 207 (Multi Status)}. If the
+     * report request included a depth other than {@link DavConstants#DEPTH_0 0}
+     * a multi status response is required.
+     */
+    protected boolean isSuccess(int statusCode) {
+        if (isDeep) {
+            return statusCode == DavServletResponse.SC_MULTI_STATUS;
+        } else {
+            return statusCode == DavServletResponse.SC_OK || statusCode == DavServletResponse.SC_MULTI_STATUS;
+        }
     }
 }

Modified: jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/SearchMethod.java
URL: http://svn.apache.org/viewcvs/jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/SearchMethod.java?rev=397929&r1=397928&r2=397929&view=diff
==============================================================================
--- jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/SearchMethod.java (original)
+++ jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/SearchMethod.java Fri Apr 28 08:47:14 2006
@@ -18,6 +18,7 @@
 import org.apache.jackrabbit.webdav.DavConstants;
 import org.apache.jackrabbit.webdav.DavMethods;
 import org.apache.jackrabbit.webdav.search.SearchInfo;
+import org.apache.jackrabbit.webdav.DavServletResponse;
 import org.apache.jackrabbit.webdav.xml.Namespace;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -44,17 +45,28 @@
             setRequestBody(searchInfo);
         }
     }
-    
+
     public SearchMethod(String uri, SearchInfo searchInfo) throws IOException {
         super(uri);
         setRequestHeader(DavConstants.HEADER_CONTENT_TYPE, "text/xml; charset=UTF-8");
         setRequestBody(searchInfo);
     }
 
+    //---------------------------------------------------------< HttpMethod >---
     /**
      * @see org.apache.commons.httpclient.HttpMethod#getName()
      */
     public String getName() {
         return DavMethods.METHOD_SEARCH;
+    }
+
+    //------------------------------------------------------< DavMethodBase >---
+    /**
+     *
+     * @param statusCode
+     * @return true if status code is {@link DavServletResponse#SC_MULTI_STATUS 207 (Multi-Status)}.
+     */
+    protected boolean isSuccess(int statusCode) {
+        return statusCode == DavServletResponse.SC_MULTI_STATUS;
     }
 }

Modified: jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/UnLockMethod.java
URL: http://svn.apache.org/viewcvs/jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/UnLockMethod.java?rev=397929&r1=397928&r2=397929&view=diff
==============================================================================
--- jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/UnLockMethod.java (original)
+++ jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/UnLockMethod.java Fri Apr 28 08:47:14 2006
@@ -17,10 +17,12 @@
 
 import org.apache.jackrabbit.webdav.DavConstants;
 import org.apache.jackrabbit.webdav.DavMethods;
+import org.apache.jackrabbit.webdav.DavServletResponse;
 import org.apache.jackrabbit.webdav.header.CodedUrlHeader;
 import org.apache.jackrabbit.webdav.header.Header;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.apache.commons.httpclient.HttpMethod;
 
 /**
  * <code>UnLockMethod</code>...
@@ -35,10 +37,22 @@
         setRequestHeader(lth);
     }
 
+    //---------------------------------------------------------< HttpMethod >---
     /**
-     * @see org.apache.commons.httpclient.HttpMethod#getName()
+     * @see HttpMethod#getName()
      */
     public String getName() {
         return DavMethods.METHOD_UNLOCK;
+    }
+
+    //------------------------------------------------------< DavMethodBase >---
+    /**
+     * @param statusCode
+     * @return true if the given status code is
+     * {@link DavServletResponse#SC_NO_CONTENT 204 (No Content)}.
+     * @see DavMethodBase#isSuccess(int)
+     */
+    protected boolean isSuccess(int statusCode) {
+        return statusCode == DavServletResponse.SC_NO_CONTENT;
     }
 }

Added: jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/UncheckoutMethod.java
URL: http://svn.apache.org/viewcvs/jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/UncheckoutMethod.java?rev=397929&view=auto
==============================================================================
--- jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/UncheckoutMethod.java (added)
+++ jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/UncheckoutMethod.java Fri Apr 28 08:47:14 2006
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.webdav.client.methods;
+
+import org.apache.jackrabbit.webdav.DavServletResponse;
+import org.apache.jackrabbit.webdav.DavMethods;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * <code>UncheckoutMethod</code>...
+ */
+public class UncheckoutMethod extends DavMethodBase {
+
+    private static Logger log = LoggerFactory.getLogger(UncheckoutMethod.class);
+
+    public UncheckoutMethod(String uri) {
+        super(uri);
+    }
+
+    //---------------------------------------------------------< HttpMethod >---
+    /**
+     * @see org.apache.commons.httpclient.HttpMethod#getName()
+     */
+    public String getName() {
+        return DavMethods.METHOD_UNCHECKOUT;
+    }
+
+
+    //------------------------------------------------------< DavMethodBase >---
+    /**
+     *
+     * @param statusCode
+     * @return true if status code is {@link DavServletResponse#SC_OK 200 (OK)}.
+     */
+    protected boolean isSuccess(int statusCode) {
+        return statusCode == DavServletResponse.SC_OK;
+    }
+}
\ No newline at end of file

Propchange: jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/UncheckoutMethod.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/UncheckoutMethod.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url

Modified: jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/UpdateMethod.java
URL: http://svn.apache.org/viewcvs/jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/UpdateMethod.java?rev=397929&r1=397928&r2=397929&view=diff
==============================================================================
--- jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/UpdateMethod.java (original)
+++ jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/UpdateMethod.java Fri Apr 28 08:47:14 2006
@@ -16,6 +16,7 @@
 package org.apache.jackrabbit.webdav.client.methods;
 
 import org.apache.jackrabbit.webdav.DavMethods;
+import org.apache.jackrabbit.webdav.DavServletResponse;
 import org.apache.jackrabbit.webdav.version.UpdateInfo;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -34,10 +35,21 @@
         setRequestBody(updateInfo);
     }
 
+    //---------------------------------------------------------< HttpMethod >---
     /**
      * @see org.apache.commons.httpclient.HttpMethod#getName()
      */
     public String getName() {
         return DavMethods.METHOD_UPDATE;
+    }
+    
+    //------------------------------------------------------< DavMethodBase >---
+    /**
+     *
+     * @param statusCode
+     * @return true if status code is {@link DavServletResponse#SC_MULTI_STATUS 207 (Multi-Status)}.
+     */
+    protected boolean isSuccess(int statusCode) {
+        return statusCode == DavServletResponse.SC_MULTI_STATUS;
     }
 }

Modified: jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/VersionControlMethod.java
URL: http://svn.apache.org/viewcvs/jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/VersionControlMethod.java?rev=397929&r1=397928&r2=397929&view=diff
==============================================================================
--- jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/VersionControlMethod.java (original)
+++ jackrabbit/trunk/jcr-server/client/src/java/org/apache/jackrabbit/webdav/client/methods/VersionControlMethod.java Fri Apr 28 08:47:14 2006
@@ -16,6 +16,7 @@
 package org.apache.jackrabbit.webdav.client.methods;
 
 import org.apache.jackrabbit.webdav.DavMethods;
+import org.apache.jackrabbit.webdav.DavServletResponse;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -30,10 +31,21 @@
         super(uri);
     }
 
+    //---------------------------------------------------------< HttpMethod >---
     /**
      * @see org.apache.commons.httpclient.HttpMethod#getName()
      */
     public String getName() {
         return DavMethods.METHOD_VERSION_CONTROL;
+    }
+
+    //------------------------------------------------------< DavMethodBase >---
+    /**
+     *
+     * @param statusCode
+     * @return true if status code is {@link DavServletResponse#SC_OK 200 (OK)}.
+     */
+    protected boolean isSuccess(int statusCode) {
+        return statusCode == DavServletResponse.SC_OK;
     }
 }



Mime
View raw message