You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by ju...@apache.org on 2003/05/21 17:49:48 UTC

cvs commit: jakarta-slide/src/webdav/server/org/apache/slide/webdav/method AbstractMultistatusResponseMethod.java AbstractWebdavMethod.java CheckinMethod.java CheckoutMethod.java CopyMethod.java DefaultMethodFactory.java DeleteMethod.java LabelMethod.java LockMethod.java MoveMethod.java OptionsMethod.java PropFindMethod.java PropPatchMethod.java ReportMethod.java SearchMethod.java UpdateMethod.java VersionControlMethod.java

juergen     2003/05/21 08:49:48

  Modified:    src/webdav/server/org/apache/slide/webdav/method
                        AbstractMultistatusResponseMethod.java
                        AbstractWebdavMethod.java CheckinMethod.java
                        CheckoutMethod.java CopyMethod.java
                        DefaultMethodFactory.java DeleteMethod.java
                        LabelMethod.java LockMethod.java MoveMethod.java
                        OptionsMethod.java PropFindMethod.java
                        PropPatchMethod.java ReportMethod.java
                        SearchMethod.java UpdateMethod.java
                        VersionControlMethod.java
  Log:
  bind method implemented as copy
  
  Revision  Changes    Path
  1.31      +17 -306   jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/AbstractMultistatusResponseMethod.java
  
  Index: AbstractMultistatusResponseMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/AbstractMultistatusResponseMethod.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- AbstractMultistatusResponseMethod.java	2 Apr 2003 12:09:18 -0000	1.30
  +++ AbstractMultistatusResponseMethod.java	21 May 2003 15:49:45 -0000	1.31
  @@ -63,31 +63,12 @@
   
   package org.apache.slide.webdav.method;
   
  -import java.security.Principal;
  -import java.io.*;
  -import java.util.*;
  -import javax.servlet.*;
  -import javax.servlet.http.*;
  +import org.apache.slide.common.NamespaceAccessToken;
  +import org.apache.slide.common.NestedSlideException;
  +import org.apache.slide.common.SlideException;
  +import org.apache.slide.webdav.WebdavException;
  +import org.apache.slide.webdav.WebdavServletConfig;
   import org.apache.util.WebdavStatus;
  -import org.apache.slide.common.*;
  -import org.apache.slide.webdav.*;
  -import org.apache.slide.macro.*;
  -import org.apache.slide.lock.*;
  -import org.apache.slide.content.*;
  -import org.apache.slide.content.NodeProperty.NamespaceCache;
  -import org.apache.slide.security.AccessDeniedException;
  -import org.apache.slide.structure.*;
  -import org.apache.slide.webdav.util.WebdavUtils;
  -import org.apache.slide.webdav.util.PreconditionViolationException;
  -import org.apache.slide.webdav.util.ViolatedPrecondition;
  -import org.apache.slide.webdav.util.WebdavConstants;
  -
  -import org.jdom.Element;
  -import org.jdom.Document;
  -import org.jdom.Namespace;
  -import org.jdom.JDOMException;
  -
  -import org.jdom.output.XMLOutputter;
   
   /**
    * Abstract class for methods which return a multistatus error report, like
  @@ -96,7 +77,7 @@
    * @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
    * @author Juergen Pill
    */
  -public abstract class AbstractMultistatusResponseMethod extends AbstractWebdavMethod implements WebdavConstants  {
  +public abstract class AbstractMultistatusResponseMethod extends AbstractWebdavMethod {
   
   
       // ----------------------------------------------------- Instance Variables
  @@ -159,150 +140,10 @@
               throw new WebdavException( statusCode );
           }
   
  -        int protocolIndex = destinationUri.indexOf("://");
  -        if (protocolIndex >= 0) {
  -            // if the Destination URL contains the protocol, we can safely
  -            // trim everything upto the first "/" character after "://"
  -            int firstSeparator =
  -                destinationUri.indexOf("/", protocolIndex + 4);
  -            if (firstSeparator < 0) {
  -                destinationUri = "/";
  -            } else {
  -                destinationUri = destinationUri.substring(firstSeparator);
  -            }
  -        } else {
  -            String hostName = req.getServerName();
  -            if ((hostName != null) && (destinationUri.startsWith(hostName))) {
  -                destinationUri = destinationUri.substring(hostName.length());
  -            }
  -
  -            int portIndex = destinationUri.indexOf(":");
  -            if (portIndex >= 0) {
  -                destinationUri = destinationUri.substring(portIndex);
  -            }
  -
  -            if (destinationUri.startsWith(":")) {
  -                int firstSeparator = destinationUri.indexOf("/");
  -                if (firstSeparator < 0) {
  -                    destinationUri = "/";
  -                } else {
  -                    destinationUri = destinationUri.substring(firstSeparator);
  -                }
  -            }
  -        }
  -
  -        // headers are "ISO-8859-1" encoded [not any more with TC 4.1.18
  -        // destinationUri = WebdavUtils.decodeURL(WebdavUtils.fixTomcatURL(destinationUri, "ISO-8859-1"));
  -        destinationUri = WebdavUtils.decodeURL(destinationUri);
  -
  -        String contextPath = req.getContextPath();
  -        if ((contextPath != null) &&
  -                (destinationUri.startsWith(contextPath))) {
  -            destinationUri = destinationUri.substring(contextPath.length());
  -        }
  -
  -        String pathInfo = req.getPathInfo();
  -        if (pathInfo != null) {
  -            String servletPath = req.getServletPath();
  -            if ((servletPath != null) &&
  -                    (destinationUri.startsWith(servletPath))) {
  -                destinationUri = destinationUri
  -                    .substring(servletPath.length());
  -            }
  -        }
  -
  -        destinationUri = getConfig().getScope() + destinationUri;
  -
  -        String overwriteHeader = req.getHeader("Overwrite");
  -
  -        if (overwriteHeader != null) {
  -            if (overwriteHeader.equalsIgnoreCase("T")) {
  -                overwrite = true;
  -            } else {
  -                overwrite = false;
  -            }
  -        } else {
  -            overwrite = true;
  -        }
  -
  -    }
  -
  -
  -    /**
  -     * Generate an XML error message.
  -     *
  -     * @param macroException Nested exception
  -     * @return String XML message
  -     */
  -    protected String generateErrorMessage
  -        (NestedSlideException nestedException) {
  -
  -        Element multistatus = new Element(E_MULTISTATUS, NamespaceCache.DEFAULT_NAMESPACE);
  -
  -        Enumeration nestedExceptionsList =
  -            nestedException.enumerateExceptions();
  -        while (nestedExceptionsList.hasMoreElements()) {
  -
  -            Element response = new Element(E_RESPONSE, NamespaceCache.DEFAULT_NAMESPACE);
  -            multistatus.addContent(response);
  -            SlideException ex =
  -                (SlideException) nestedExceptionsList.nextElement();
  -            generateStatusText(response, getErrorMessage(ex),
  -                               getErrorCode(ex));
  -            if (ex instanceof PreconditionViolationException) {
  -                response.addContent(getPreconditionViolationResponseDescription((PreconditionViolationException)ex));
  -            }
  -
  -        }
  -
  -        StringWriter stringWriter = new StringWriter();
  -        try {
  -            new XMLOutputter().output(multistatus, stringWriter);
  -        }
  -        catch (IOException e) {
  -            Domain.log(e);
  -        }
  -        return stringWriter.toString();
  -
  -    }
  -
  -
  -    /**
  -     * Generate status text.
  -     *
  -     * @param parentElement  the parent Element to append to.
  -     * @param href Uri of the object
  -     * @param statusCode HTTP status code of the error
  -     */
  -    protected void generateStatusText(Element parentElement, String href, int statusCode) {
  -
  -        Element hrefElement = new Element(E_HREF, NamespaceCache.DEFAULT_NAMESPACE);
  -        parentElement.addContent(hrefElement);
  -        hrefElement.setText(getFullPath(href));
  -        Element statusElement = new Element(E_STATUS, NamespaceCache.DEFAULT_NAMESPACE);
  -        parentElement.addContent(statusElement);
  -        statusElement.setText("HTTP/1.1 " + statusCode + " "
  -                              + WebdavStatus.getStatusText(statusCode));
  +        destinationUri = parseUri(destinationUri);
  +        overwrite = MethodUtil.getOverwriteHeader(req);
       }
   
  -
  -    /**
  -     * Generate &lt;responsedescription&gt; for the given precondition violation.
  -     *
  -     * @param pve the ProconditionViolationException that describes the violated
  -     *            precondition.
  -     *
  -     * @return the &lt;responsedescription&gt; for the given precondition violation.
  -     */
  -    protected Element getPreconditionViolationResponseDescription(PreconditionViolationException pve) {
  -
  -        Element responseDescription = new Element(E_RESPONSEDESCRIPTION, NamespaceCache.DEFAULT_NAMESPACE);
  -        responseDescription.addContent(getPreconditionViolationError(pve.getViolatedPrecondition()));
  -        return responseDescription;
  -    }
  -
  -
  -
       /**
        * Returns true
        */
  @@ -311,7 +152,6 @@
       }
   
   
  -
       /**
        * Checks if a 207 should be generated. A 207 is generated when the request URI is a
        * collection and exactely one nested exception is present and the request URI and
  @@ -320,147 +160,18 @@
        * @return boolean return true, if a 207 response code should be generated
        */
   
  -    protected boolean generate207Response(boolean isCollection, NestedSlideException causeException, String resourceURI) {
  -
  -        boolean is207 = false;
  +    public static boolean generateMultiStatusResponse(boolean isCollection, NestedSlideException causeException, String resourceURI) {
  +        boolean isMultiStatus = false;
           if (isCollection) {
               if (causeException.getExceptionsCount() > 1) {
  -                is207 = true;
  +                isMultiStatus = true;
               }
               else if (causeException.getExceptionsCount() == 1) {
  -        SlideException unpackedException = causeException.unpackSingleException();
  -                is207 =  ! resourceURI.equals(getURI(unpackedException));
  +                SlideException unpackedException = causeException.unpackSingleException();
  +                isMultiStatus =  ! resourceURI.equals(MethodUtil.getURI(unpackedException));
               }
           }
  -        return is207;
  -    }
  -
  -    // -------------------------------------------------------- Private Methods
  -
  -    // -------------------------------------------------------- Private Methods
  -
  -
  -    /**
  -     * Get return status based on exception type.
  -     */
  -    protected String getErrorMessage(Throwable ex) {
  -        if ( !(ex instanceof SlideException) ) {
  -            return "";
  -        } else {
  -            return getErrorMessage((SlideException)ex);
  -        }
  -    }
  -
  -
  -
  -    /**
  -     * Get the return status message info on exception type.
  -     */
  -    private String getErrorMessage(SlideException ex) {
  -        try {
  -            throw ex;
  -        } catch(ObjectNotFoundException e) {
  -            return e.getObjectUri();
  -        } catch(ConflictException e) {
  -            return e.getObjectUri();
  -        } catch(ForbiddenException e) {
  -            return e.getObjectUri();
  -        } catch(AccessDeniedException e) {
  -            return e.getObjectUri();
  -        } catch(ObjectAlreadyExistsException e) {
  -            return e.getObjectUri();
  -        } catch(ServiceAccessException e) {
  -            return getErrorMessage((ServiceAccessException)e);
  -        } catch(LinkedObjectNotFoundException e) {
  -            return e.getTargetUri();
  -        } catch(RevisionNotFoundException e) {
  -            return e.getObjectUri();
  -        } catch(ObjectLockedException e) {
  -            return e.getObjectUri();
  -        } catch(PreconditionViolationException e) {
  -            return e.getObjectUri();
  -        } catch(SlideException e) {
  -            return e.getMessage();
  -        }
  +        return isMultiStatus;
       }
  -
  -
  -
  -
  -    /**
  -     * Get return status based on exception type.
  -     */
  -    private String getErrorMessage(ServiceAccessException ex) {
  -        Throwable cause = ex.getCauseException();
  -        if (cause == null || !(cause instanceof SlideException) )  {
  -            return "";  // this is the default}
  -        } else  {
  -            return getErrorMessage((SlideException)cause);
  -        }
  -    }
  -
  -
  -    /**
  -     * Get return status based on exception type.
  -     */
  -    private String getURI(Throwable ex) {
  -        if ( !(ex instanceof SlideException) ) {
  -            return "";
  -        } else {
  -            return getURI((SlideException)ex);
  -        }
  -    }
  -
  -
  -    /**
  -     * Get the URI contained in the exception, if available.
  -     */
  -    private String getURI(SlideException ex) {
  -        try {
  -            throw ex;
  -        } catch(ObjectNotFoundException e) {
  -            return e.getObjectUri();
  -        } catch(ConflictException e) {
  -            return e.getObjectUri();
  -        } catch(ForbiddenException e) {
  -            return e.getObjectUri();
  -        } catch(AccessDeniedException e) {
  -            return e.getObjectUri();
  -        } catch(ObjectAlreadyExistsException e) {
  -            return e.getObjectUri();
  -        } catch(ServiceAccessException e) {
  -            return getURI((ServiceAccessException)ex);
  -        } catch(LinkedObjectNotFoundException e) {
  -            return e.getTargetUri();
  -        } catch(RevisionNotFoundException e) {
  -            return e.getObjectUri();
  -        } catch(ObjectLockedException e) {
  -            return e.getObjectUri();
  -        } catch(SlideException e) {
  -            return "";
  -        }
  -    }
  -
  -
  -
  -    /**
  -     * Get return status based on exception type.
  -     */
  -    private String getURI(ServiceAccessException ex) {
  -        Throwable cause = ex.getCauseException();
  -        if (cause == null || !(cause instanceof SlideException) )  {
  -            return "";  // this is the default}
  -        } else  {
  -            return getURI((SlideException)cause);
  -        }
  -    }
  -
  -
  -
  -
  -
  -
  -
   }
  -
   
  
  
  
  1.9       +143 -36   jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/AbstractWebdavMethod.java
  
  Index: AbstractWebdavMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/AbstractWebdavMethod.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- AbstractWebdavMethod.java	7 Apr 2003 11:45:42 -0000	1.8
  +++ AbstractWebdavMethod.java	21 May 2003 15:49:45 -0000	1.9
  @@ -65,11 +65,15 @@
   
   import java.io.IOException;
   import java.io.StringReader;
  +import java.io.StringWriter;
   import java.security.MessageDigest;
   import java.security.NoSuchAlgorithmException;
  +import java.util.Enumeration;
   import javax.servlet.http.HttpServletRequest;
   import javax.servlet.http.HttpServletResponse;
  +import org.apache.slide.common.Domain;
   import org.apache.slide.common.NamespaceAccessToken;
  +import org.apache.slide.common.NestedSlideException;
   import org.apache.slide.common.ServiceAccessException;
   import org.apache.slide.common.SlideException;
   import org.apache.slide.common.SlideToken;
  @@ -113,7 +117,7 @@
    * @author Christopher Lenz
    */
   public abstract class AbstractWebdavMethod
  -    implements WebdavMethod {
  +    implements WebdavMethod, WebdavConstants {
   
   
       // -------------------------------------------------------------- Constants
  @@ -541,6 +545,81 @@
           return requestContentDocument;
       }
   
  +    //--
  +
  +    /**
  +     * precondition: sourceUri != null
  +     */
  +    protected String parseUri(String uri) throws WebdavException {  // TODO: better name
  +        int protocolIndex = uri.indexOf("://");
  +        if (protocolIndex >= 0) {
  +            // if the Destination URL contains the protocol, we can safely
  +            // trim everything upto the first "/" character after "://"
  +            int firstSeparator =
  +                uri.indexOf("/", protocolIndex + 4);
  +            if (firstSeparator < 0) {
  +                uri = "/";
  +            } else {
  +                uri = uri.substring(firstSeparator);
  +            }
  +        } else {
  +            String hostName = req.getServerName();
  +            if ((hostName != null) && (uri.startsWith(hostName))) {
  +                uri = uri.substring(hostName.length());
  +            }
  +
  +            int portIndex = uri.indexOf(":");
  +            if (portIndex >= 0) {
  +                uri = uri.substring(portIndex);
  +            }
  +
  +            if (uri.startsWith(":")) {
  +                int firstSeparator = uri.indexOf("/");
  +                if (firstSeparator < 0) {
  +                    uri = "/";
  +                } else {
  +                    uri = uri.substring(firstSeparator);
  +                }
  +            }
  +        }
  +
  +        // headers are "ISO-8859-1" encoded [not any more with TC 4.1.18
  +        // destinationUri = WebdavUtils.decodeURL(WebdavUtils.fixTomcatURL(destinationUri, "ISO-8859-1"));
  +        uri = WebdavUtils.decodeURL(uri);
  +
  +        String contextPath = req.getContextPath();
  +        if ((contextPath != null) && (uri.startsWith(contextPath))) {
  +            uri = uri.substring(contextPath.length());
  +        }
  +
  +        String pathInfo = req.getPathInfo();
  +        if (pathInfo != null) {
  +            String servletPath = req.getServletPath();
  +            if ((servletPath != null) && (uri.startsWith(servletPath))) {
  +                uri = uri.substring(servletPath.length());
  +            }
  +        }
  +        uri = getConfig().getScope() + uri;
  +
  +        return uri;
  +    }
  +
  +    protected Element parseRequestContent(String rootName) throws JDOMException, IOException {
  +        Document document;
  +        Element root;
  +
  +        document = parseRequestContent();
  +        if (document == null) {
  +            throw new JDOMException("Request content missing");
  +        }
  +        root = document.getRootElement();
  +        if( root == null || !root.getName().equals(rootName) ) {
  +            Domain.warn( "Root element must be "+rootName );
  +            throw new JDOMException("Root element must be <"+rootName+">");
  +        }
  +        return root;
  +    }
  +
       /**
        * Parses the request content (XML) Document.
        *
  @@ -599,37 +678,6 @@
       }
   
       /**
  -     * Generate &lt;error&gt; for the given precondition violation.
  -     *
  -     * @param     violatedPrecondition  the ViolatedPrecondition that describes
  -     *                                  the violated precondition.
  -     *
  -     * @return the &lt;error&gt; for the given precondition violation.
  -     */
  -    protected Element getPreconditionViolationError(ViolatedPrecondition violatedPrecondition) {
  -        return getPreconditionViolationError(violatedPrecondition,
  -                                             NamespaceCache.DEFAULT_NAMESPACE);
  -    }
  -
  -    /**
  -     * Generate &lt;error&gt; for the given precondition violation.
  -     *
  -     * @param     violatedPrecondition  the ViolatedPrecondition that describes
  -     *                                  the violated precondition.
  -     *
  -     * @return the &lt;error&gt; for the given precondition violation.
  -     */
  -    protected Element getPreconditionViolationError(ViolatedPrecondition violatedPrecondition, org.jdom.Namespace namespace) {
  -
  -        Element error = new Element(WebdavConstants.E_ERROR,
  -                                                     namespace);
  -        Element violatedPreconditionElement = new Element(violatedPrecondition.getPrecondition(),
  -                                                                            namespace);
  -        error.addContent(violatedPreconditionElement);
  -        return error;
  -    }
  -
  -    /**
        * Sends a precondition vilolation response.
        *
        * @param pve the ProconditionViolationException that describes the violated
  @@ -647,7 +695,7 @@
               resp.setContentType(TEXT_XML_UTF_8);
   
               new XMLOutputter(XML_REPONSE_INDENT, true).
  -                output(new Document(getPreconditionViolationError(pve.getViolatedPrecondition())), resp.getWriter());
  +                output(new Document(MethodUtil.getPreconditionViolationError(pve.getViolatedPrecondition())), resp.getWriter());
           }
       }
   
  @@ -822,6 +870,65 @@
           if( statusCode >= printStackTraceFrom )
               x.printStackTrace();
       }
  +
  +
  +    /**
  +     * Generate status text.
  +     *
  +     * @param parentElement  the parent Element to append to.
  +     * @param href Uri of the object
  +     * @param statusCode HTTP status code of the error
  +     */
  +    protected void generateStatusText(Element parentElement, String href, int statusCode) {
  +
  +        Element hrefElement = new Element(E_HREF, NamespaceCache.DEFAULT_NAMESPACE);
  +        parentElement.addContent(hrefElement);
  +        hrefElement.setText(getFullPath(href));
  +        Element statusElement = new Element(E_STATUS, NamespaceCache.DEFAULT_NAMESPACE);
  +        parentElement.addContent(statusElement);
  +        statusElement.setText("HTTP/1.1 " + statusCode + " "
  +                                  + WebdavStatus.getStatusText(statusCode));
  +    }
  +
  +    /**
  +     * Generate an XML error message.
  +     *
  +     * @param macroException Nested exception
  +     * @return String XML message
  +     */
  +    protected String generateErrorMessage
  +        (NestedSlideException nestedException) {
  +
  +        Element multistatus = new Element(E_MULTISTATUS, NamespaceCache.DEFAULT_NAMESPACE);
  +
  +        Enumeration nestedExceptionsList =
  +            nestedException.enumerateExceptions();
  +        while (nestedExceptionsList.hasMoreElements()) {
  +
  +            Element response = new Element(E_RESPONSE, NamespaceCache.DEFAULT_NAMESPACE);
  +            multistatus.addContent(response);
  +            SlideException ex =
  +                (SlideException) nestedExceptionsList.nextElement();
  +            generateStatusText(response, MethodUtil.getErrorMessage(ex),
  +                               getErrorCode(ex));
  +            if (ex instanceof PreconditionViolationException) {
  +                response.addContent(MethodUtil.getPreconditionViolationResponseDescription((PreconditionViolationException)ex));
  +            }
  +
  +        }
  +
  +        StringWriter stringWriter = new StringWriter();
  +        try {
  +            new XMLOutputter().output(multistatus, stringWriter);
  +        }
  +        catch (IOException e) {
  +            Domain.log(e);
  +        }
  +        return stringWriter.toString();
  +
  +    }
  +
   }
  +
   
   
  
  
  
  1.20      +4 -9      jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/CheckinMethod.java
  
  Index: CheckinMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/CheckinMethod.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- CheckinMethod.java	31 Oct 2002 14:50:20 -0000	1.19
  +++ CheckinMethod.java	21 May 2003 15:49:45 -0000	1.20
  @@ -121,12 +121,7 @@
           if( req.getContentLength() > 0 ) {
               readRequestContent();
               try{
  -                Element cie = parseRequestContent().getRootElement();
  -                if( cie == null || !cie.getName().equals(E_CHECKIN) ) {
  -                    Domain.warn( "Root element must be "+E_CHECKIN );
  -                    throw new JDOMException("Root element must be <"+E_CHECKIN+">");
  -                }
  -                Iterator i = cie.getChildren().iterator();
  +                Iterator i = parseRequestContent(E_CHECKIN).getChildren().iterator();
                   while( i.hasNext() ) {
                       Element e = (Element)i.next();
                       if( e.getName().equals(E_FORK_OK) )
  
  
  
  1.23      +4 -9      jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/CheckoutMethod.java
  
  Index: CheckoutMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/CheckoutMethod.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- CheckoutMethod.java	23 Aug 2002 14:25:20 -0000	1.22
  +++ CheckoutMethod.java	21 May 2003 15:49:46 -0000	1.23
  @@ -161,12 +161,7 @@
           if( req.getContentLength() > 0 ) {
               readRequestContent();
               try{
  -                Element coe = parseRequestContent().getRootElement();
  -                if( coe == null || !coe.getName().equals(E_CHECKOUT) ) {
  -                    Domain.warn( "Root element must be "+E_CHECKOUT );
  -                    throw new JDOMException("Root element must be <"+E_CHECKOUT+">");
  -                }
  -                Iterator i = coe.getChildren().iterator();
  +                Iterator i = parseRequestContent(E_CHECKOUT).getChildren().iterator();
                   while( i.hasNext() ) {
                       Element e = (Element)i.next();
                       if ( e.getName().equals(E_APPLY_TO_VERSION) ) {
  
  
  
  1.53      +10 -13    jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/CopyMethod.java
  
  Index: CopyMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/CopyMethod.java,v
  retrieving revision 1.52
  retrieving revision 1.53
  diff -u -r1.52 -r1.53
  --- CopyMethod.java	14 Feb 2003 14:34:34 -0000	1.52
  +++ CopyMethod.java	21 May 2003 15:49:46 -0000	1.53
  @@ -85,7 +85,6 @@
   import org.apache.slide.lock.ObjectLockedException;
   import org.apache.slide.macro.CopyListener;
   import org.apache.slide.macro.CopyRouteRedirector;
  -import org.apache.slide.macro.CopyRouteRedirector.CopyRoute;
   import org.apache.slide.macro.DeleteListener;
   import org.apache.slide.macro.Macro;
   import org.apache.slide.macro.MacroException;
  @@ -144,7 +143,7 @@
       protected String labelHeader = null;
   
       private boolean isInVersioncontrolExcludePath = false;
  -    
  +
   
       // ----------------------------------------------------------- Constructors
   
  @@ -188,7 +187,6 @@
           slideToken.setForceStoreEnlistment(true);
   
           MacroParameters macroParameters = null;
  -        String status = null;
           boolean isCollection = isCollection(sourceUri);
   
           if (overwrite) {
  @@ -204,7 +202,7 @@
               if( exUh.isAncestorOf(destUh) )
                   isInVersioncontrolExcludePath = true;
           }
  -        
  +
           if (destUh.isRestrictedUri()) {
               boolean sendError = true;
               if( destUh.isWorkspaceUri()        ||
  @@ -218,10 +216,10 @@
                   catch( Exception x ) {};
               }
               if( sendError ) {
  -            int statusCode = WebdavStatus.SC_FORBIDDEN;
  -            sendError( statusCode, getClass().getName()+".restrictedDestinationUri", new Object[]{destinationUri} );
  -            throw new WebdavException( statusCode );
  -        }
  +                int statusCode = WebdavStatus.SC_FORBIDDEN;
  +                sendError( statusCode, getClass().getName()+".restrictedDestinationUri", new Object[]{destinationUri} );
  +                throw new WebdavException( statusCode );
  +            }
           }
   
           try {
  @@ -232,7 +230,7 @@
                   resp.setStatus(WebdavStatus.SC_CREATED);
               }
           } catch (MacroException e) {
  -            if(generate207Response(isCollection, e, requestUri)) {
  +            if(generateMultiStatusResponse(isCollection, e, requestUri)) {
                   String errorMessage = generateErrorMessage(e);
                   // Write it on the servlet writer
                   resp.setStatus(WebdavStatus.SC_MULTI_STATUS);
  @@ -636,7 +634,6 @@
   
   
   }
  -
   
   
   
  
  
  
  1.2       +5 -3      jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/DefaultMethodFactory.java
  
  Index: DefaultMethodFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/DefaultMethodFactory.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultMethodFactory.java	14 Jun 2002 12:57:15 -0000	1.1
  +++ DefaultMethodFactory.java	21 May 2003 15:49:46 -0000	1.2
  @@ -124,6 +124,8 @@
               return new PostMethod(token, config);
           } else if (name.equals("COPY")) {
               return new CopyMethod(token, config);
  +        } else if (name.equals("BIND")) {
  +            return new BindMethod(token, config);
           } else if (name.equals("MOVE")) {
               return new MoveMethod(token, config);
           } else if (name.equals("DELETE")) {
  
  
  
  1.29      +5 -5      jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/DeleteMethod.java
  
  Index: DeleteMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/DeleteMethod.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- DeleteMethod.java	24 Oct 2002 08:30:06 -0000	1.28
  +++ DeleteMethod.java	21 May 2003 15:49:46 -0000	1.29
  @@ -180,7 +180,7 @@
               // If it's not a collection, we don't want to give a 207,
               // because it's silly, and it confuses many clients (such as
               // MS Web Folders).
  -            if (generate207Response(isCollection, dme, requestUri)) {
  +            if (generateMultiStatusResponse(isCollection, dme, requestUri)) {
                   String errorMessage = generateErrorMessage(dme);
                   // Write it on the servlet writer
                   resp.setStatus(WebdavStatus.SC_MULTI_STATUS);
  @@ -268,7 +268,7 @@
                   catch( RevisionDescriptorNotFoundException e ) {
                       // Nothing to do if the VR is gone, e.g. because the VHR was deleted.
                   }
  -                catch (JDOMException e) {
  +                catch( JDOMException e ) {
                       throw new SlideException(
                           "Unable to update DAV:checkout-set of "+vrUri+": "+e.getMessage() );
                   }
  
  
  
  1.15      +6 -29     jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/LabelMethod.java
  
  Index: LabelMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/LabelMethod.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- LabelMethod.java	23 Aug 2002 14:25:20 -0000	1.14
  +++ LabelMethod.java	21 May 2003 15:49:46 -0000	1.15
  @@ -104,24 +104,12 @@
    * @author <a href="mailto:ralf.stuckert@softwareag.com">Ralf Stuckert</a>
    */
   public class LabelMethod extends AbstractMultistatusResponseMethod implements DeltavConstants {
  -
  -    /**
  -     ** String constant for <code>Request content missing</code>.
  -     **/
  -    public static final String CONTENT_MISSING = "Request content missing";
  -
       /**
        ** String constant for <code>Label missing</code>.
        **/
       public static final String LABEL_MISSING = "Label missing";
   
       /**
  -     * String constant for <code>"Request content must start with a &lt;label&gt;
  -     * element</code>.
  -     */
  -    public static final String MUST_START_WITH_LABEL = "Request content must start with a <"+E_LABEL+"> element";
  -
  -    /**
        * String constant for <code>Request content &lt;label&gt; element must
        * contain either &lt;add&gt;, &lt;set&gt; or &lt;remove&gt;</code>.
        */
  @@ -198,18 +186,7 @@
           labelHeader = WebdavUtils.fixTomcatHeader(req.getHeader(DeltavConstants.H_LABEL), "UTF-8");
   
           try{
  -            Document document = parseRequestContent();
  -            if (document == null) {
  -                throw new JDOMException(CONTENT_MISSING);
  -            }
  -            Element root = document.getRootElement();
  -            if (root == null) {
  -                throw new JDOMException(CONTENT_MISSING);
  -            }
  -            if ( ! DeltavConstants.E_LABEL.equals(root.getName())) {
  -                throw new JDOMException(MUST_START_WITH_LABEL);
  -            }
  -
  +            Element root = parseRequestContent(DeltavConstants.E_LABEL);
               Element current = root.getChild(DeltavConstants.E_ADD, NamespaceCache.DEFAULT_NAMESPACE);
               Element operationElement = null;
               if (current != null) {
  @@ -272,7 +249,7 @@
               // If it's not a collection, we don't want to give a 207,
               // because it's silly, and it confuses many clients (such as
               // MS Web Folders).
  -            if (generate207Response(isCollection, nestedSlideException, requestUri)) {
  +            if (generateMultiStatusResponse(isCollection, nestedSlideException, requestUri)) {
                   String errorMessage = generateErrorMessage(nestedSlideException);
                   // Write it on the servlet writer
                   resp.setStatus(WebdavStatus.SC_MULTI_STATUS);
  
  
  
  1.44      +282 -282  jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/LockMethod.java
  
  Index: LockMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/LockMethod.java,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- LockMethod.java	14 Feb 2003 14:34:34 -0000	1.43
  +++ LockMethod.java	21 May 2003 15:49:46 -0000	1.44
  @@ -95,123 +95,123 @@
    * @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
    */
   public class LockMethod extends AbstractMultistatusResponseMethod {
  -    
  -    
  +
  +
       // -------------------------------------------------------------- Constants
  -    
  -    
  +
  +
       /**
        * Default depth is infite.
        */
       private static final int INFINITY = -1;
  -    
  -    
  +
  +
       /**
        * Create a new lock.
        */
       private static final int LOCK_CREATION = 0;
  -    
  -    
  +
  +
       /**
        * Refresh lock.
        */
       private static final int LOCK_REFRESH = 1;
  -    
  -    
  +
  +
       /**
        * Default timeout value.
        */
       private static final int DEFAULT_TIMEOUT = 3600;
  -    
  -    
  +
  +
       /**
        * Maximum timeout.
        */
       private static final int MAX_TIMEOUT = 604800;
  -    
  +
       /**
        * The default owner if not explicitely specified by the request.
        */
       public static final String DEFAULT_LOCK_OWNER = "";
  -    
  +
       // ----------------------------------------------------- Instance Variables
  -    
  -    
  +
  +
       /**
        * Depth.
        */
       private int depth;
  -    
  -    
  +
  +
       /**
        * Type of the LOCK method.
        */
       private int lockType;
  -    
  -    
  +
  +
       /**
        * Lock duration.
        */
       private int lockDuration = DEFAULT_TIMEOUT;
  -    
  -    
  +
  +
       /**
        * DAV Namespace support.
        */
       private boolean davNative;
  -    
  -    
  +
  +
       /**
        * Lock scope.
        */
       private String lockInfo_lockScope;
  -    
  -    
  +
  +
       /**
        * Lock type.
        */
       private String lockInfo_lockType;
  -    
  -    
  +
  +
       /**
        * Lock owner.
        */
       private String lockInfo_lockOwner;
  -    
  -    
  +
  +
       /**
        * Lock subject.
        */
       private String lockInfo_lockSubject;
  -    
  +
       /**
        * The PropertyHelper used by this instance.
        */
       protected PropertyHelper propertyHelper = null;
  -    
  +
       /**
        * The URL of the server, e.g. <code>http://www.aloha.com:8080</code>
        */
       protected String serverURL = null;
  -    
  -    
  +
  +
       // ----------------------------------------------------------- Constructors
  -    
  -    
  +
  +
       /**
        * Constructor.
  -     * 
  +     *
        * @param token     the token for accessing the namespace
        * @param config    configuration of the WebDAV servlet
        */
       public LockMethod(NamespaceAccessToken token, WebdavServletConfig config) {
           super(token, config);
       }
  -    
  -    
  +
  +
       // ------------------------------------------------------ Protected Methods
  -    
  -    
  +
  +
       /**
        * Parse request.
        *
  @@ -219,20 +219,20 @@
        */
       protected void parseRequest()
           throws WebdavException {
  -        
  +
           propertyHelper = PropertyHelper.getPropertyHelper(slideToken, token, getConfig());
           readRequestContent();
  -        
  +
           serverURL = HTTP_PROTOCOL + req.getServerName()+ ":" + req.getServerPort();
  -        
  +
           // Loads the associated object from the store.
           lockInfo_lockSubject = requestUri;
           if (lockInfo_lockSubject == null) {
               lockInfo_lockSubject = "/";
           }
  -        
  +
           String depthStr = req.getHeader("Depth");
  -    
  +
           if (depthStr == null) {
               depth = INFINITY;
           } else {
  @@ -242,7 +242,7 @@
                   depth = INFINITY;
               }
           }
  -        
  +
           String lockDurationStr = req.getHeader("Timeout");
           if (lockDurationStr != null) {
               int firstCommaPos = lockDurationStr.indexOf(',');
  @@ -272,16 +272,16 @@
                   lockDuration = MAX_TIMEOUT;
               }
           }
  -        
  +
           if (req.getContentLength() > 0) {
               parseLockInfo();
           }
           else {
               lockType = LOCK_REFRESH;
           }
  -        
  +
       }
  -    
  +
       /**
        * Parses the <code>&lt;lockinfo&gt;</code> request content document.
        *
  @@ -289,59 +289,59 @@
        *                              the request is not valid.
        */
       private void parseLockInfo() throws WebdavException {
  -            
  -            lockType = LOCK_CREATION;
  -            
  -            try {
  +
  +        lockType = LOCK_CREATION;
  +
  +        try {
               Document document = parseRequestContent();
               if (document == null) {
                   throw new JDOMException("Request content missing");
               }
  -                
  +
               Element lockInfoElement = document.getRootElement();
               if ( (lockInfoElement == null) ||
                       ( ! E_LOCKINFO.equals(lockInfoElement.getName()) ) ) {
                   throw new JDOMException("Request must start with <"+E_LOCKINFO+"> element");
               }
  -            
  +
               StringWriter strWriter = null;
               PropertyWriter propertyWriter = null;
  -            
  +
               Element lockScopeElement = null;
               Element lockTypeElement = null;
               Element lockOwnerElement = null;
  -            
  +
               Iterator childrenIterator = lockInfoElement.getChildren().iterator();
               Element currentElement = null;
               while (childrenIterator.hasNext()) {
                   currentElement = (Element)childrenIterator.next();
                   if (E_LOCKSCOPE.equals(currentElement.getName())) {
                       lockScopeElement = currentElement;
  -                    }
  +                }
                   else if (E_LOCKTYPE.equals(currentElement.getName())) {
                       lockTypeElement = currentElement;
  -                    }
  +                }
                   else if (E_OWNER.equals(currentElement.getName())) {
                       lockOwnerElement = currentElement;
                   }
               }
  -            
  +
               parseLockScope(lockScopeElement);
               parseLockType(lockTypeElement);
               parseOwner(lockOwnerElement);
  -                        }
  +        }
           catch (JDOMException e) {
               int statusCode = WebdavStatus.SC_BAD_REQUEST;
               sendError( statusCode, e );
               throw new WebdavException( statusCode );
  -                    }
  +        }
           catch (IOException e) {
               int statusCode = WebdavStatus.SC_INTERNAL_SERVER_ERROR;
               sendError( statusCode, e );
               throw new WebdavException( statusCode );
  -                }
  -            }
  -            
  +        }
  +    }
  +
       /**
        * Parses the <code>&lt;lockscope&gt;</code> part of the request content
        * document.
  @@ -352,19 +352,19 @@
        *                           the request is not valid.
        */
       private void parseLockScope(Element lockScopeElement) throws JDOMException {
  -                
  +
           if (lockScopeElement == null) {
               throw new JDOMException("Expected <"+E_LOCKSCOPE+"> element");
  -                }
  -                
  +        }
  +
           List children = lockScopeElement.getChildren();
           if (children.size() != 1) {
               throw new JDOMException("<"+E_LOCKSCOPE+"> must have exactly one child element");
  -                }
  -                
  +        }
  +
           lockInfo_lockScope = ((Element)children.get(0)).getName();
  -            }
  -            
  +    }
  +
       /**
        * Parses the <code>&lt;locktype&gt;</code> part of the request content
        * document.
  @@ -375,19 +375,19 @@
        *                           the request is not valid.
        */
       private void parseLockType(Element lockTypeElement) throws JDOMException {
  -                
  +
           if (lockTypeElement == null) {
               throw new JDOMException("Expected <"+E_LOCKTYPE+"> element");
  -                    }
  -        
  +        }
  +
           List children = lockTypeElement.getChildren();
           if (children.size() != 1) {
               throw new JDOMException("<"+E_LOCKTYPE+"> must have exactly one child element");
  -                }
  -                
  +        }
  +
           lockInfo_lockType = ((Element)children.get(0)).getName();
  -                }
  -                
  +    }
  +
       /**
        * Parses the <code>&lt;owner&gt;</code> part of the request content
        * document.
  @@ -398,13 +398,13 @@
        *                           the request is not valid.
        */
       private void parseOwner(Element ownerElement) throws JDOMException {
  -        
  +
           if (ownerElement == null) {
               lockInfo_lockOwner = DEFAULT_LOCK_OWNER;
               return;
               //          throw new JDOMException("Expected <"+E_OWNER+"> element");
           }
  -            
  +
           StringWriter stringWriter = new StringWriter();
           XMLOutputter xmlOutputter = new XMLOutputter();
           try {
  @@ -419,11 +419,11 @@
   
           if (lockInfo_lockOwner.length() == 0) {
               lockInfo_lockOwner = DEFAULT_LOCK_OWNER;
  -//          throw new JDOMException("<"+E_OWNER+"> element must not be empty");
  +            //          throw new JDOMException("<"+E_OWNER+"> element must not be empty");
           }
       }
  -    
  -    
  +
  +
       /**
        * Execute request.
        *
  @@ -431,219 +431,219 @@
        */
       protected void executeRequest()
           throws WebdavException {
  -        
  +
           // Prevent dirty reads
           slideToken.setForceStoreEnlistment(true);
  -        
  -        
  +
  +
           SubjectNode toLockSubject = null;
           boolean isCollection = isCollection(lockInfo_lockSubject);
           boolean inheritance = false;
           Date lockDate = null;
  -        
  +
           switch (lockType) {
  -            
  -        case LOCK_CREATION:
  -            
  -            try {
  -                
  -                NamespaceConfig namespaceConfig = token.getNamespaceConfig();
  -                
  +
  +            case LOCK_CREATION:
  +
                   try {
  -                    toLockSubject = (SubjectNode) structure
  -                        .retrieve(slideToken, lockInfo_lockSubject);
  -                } catch (ObjectNotFoundException ex) {
  -                    
  -                    // Creating a lock null resource
  -                    toLockSubject = new SubjectNode();
  -                    
  -                    // Creating new subject
  -                    structure.create(slideToken, toLockSubject,
  -                                     lockInfo_lockSubject);
  -                    
  -                    NodeRevisionDescriptor revisionDescriptor =
  -                        new NodeRevisionDescriptor(0);
  -                    
  -                    // Resource type
  -                    revisionDescriptor.setResourceType("<lock-null/>");
  -                    
  -                    // Creating the revision descriptor
  -                    content.create(slideToken, lockInfo_lockSubject,
  -                                   revisionDescriptor, null);
  -                    
  -                    // HACK
  -                    // Setting a max timeout when creating a lock-null
  -                    // resource because the associated lock-null wouldn't
  -                    // be automatically removed when the lock expires
  -                    lockDate = new Date((new Date()).getTime()
  -                                        + (MAX_TIMEOUT * 1000));
  -                    
  -                }
  -                
  -                SubjectNode credentialsSubject =
  -                    (SubjectNode) structure.retrieve
  -                    (slideToken, namespaceConfig.getUsersPath() + "/"
  -                     + slideToken.getCredentialsToken()
  -                     .getPublicCredentials());
  -                
  -                NodeLock lockToken = null;
  -                
  -                inheritance = (depth != 0);
  -                boolean exclusive =
  +
  +                    NamespaceConfig namespaceConfig = token.getNamespaceConfig();
  +
  +                    try {
  +                        toLockSubject = (SubjectNode) structure
  +                            .retrieve(slideToken, lockInfo_lockSubject);
  +                    } catch (ObjectNotFoundException ex) {
  +
  +                        // Creating a lock null resource
  +                        toLockSubject = new SubjectNode();
  +
  +                        // Creating new subject
  +                        structure.create(slideToken, toLockSubject,
  +                                         lockInfo_lockSubject);
  +
  +                        NodeRevisionDescriptor revisionDescriptor =
  +                            new NodeRevisionDescriptor(0);
  +
  +                        // Resource type
  +                        revisionDescriptor.setResourceType("<lock-null/>");
  +
  +                        // Creating the revision descriptor
  +                        content.create(slideToken, lockInfo_lockSubject,
  +                                       revisionDescriptor, null);
  +
  +                        // HACK
  +                        // Setting a max timeout when creating a lock-null
  +                        // resource because the associated lock-null wouldn't
  +                        // be automatically removed when the lock expires
  +                        lockDate = new Date((new Date()).getTime()
  +                                                + (MAX_TIMEOUT * 1000));
  +
  +                    }
  +
  +                    SubjectNode credentialsSubject =
  +                        (SubjectNode) structure.retrieve
  +                        (slideToken, namespaceConfig.getUsersPath() + "/"
  +                             + slideToken.getCredentialsToken()
  +                             .getPublicCredentials());
  +
  +                    NodeLock lockToken = null;
  +
  +                    inheritance = (depth != 0);
  +                    boolean exclusive =
                           !(lockInfo_lockScope.equals(E_SHARED));
  -                
  -                if (lockDate == null)
  -                    lockDate = new Date((new Date()).getTime()
  -                                        + (lockDuration * 1000));
  -                
  -                lockToken =
  -                    new NodeLock(toLockSubject, credentialsSubject,
  -                                 namespaceConfig.getCreateObjectAction(),
  -                                     lockDate, inheritance, exclusive, lockInfo_lockOwner);
  -                lock.lock(slideToken, lockToken);
  -                
  -                try {
  -                    lockToken = new NodeLock
  -                        (lockToken,
  -                         namespaceConfig.getCreateRevisionMetadataAction()
  -                         .getUri());
  -                    lock.lock(slideToken, lockToken);
  -                } catch (ObjectIsAlreadyLockedException e) {
  -                    // Silent catch
  -                }
   
  -                try {
  -                    lockToken = new NodeLock
  -                        (lockToken,
  -                         namespaceConfig.getModifyRevisionMetadataAction()
  -                         .getUri());
  -                    lock.lock(slideToken, lockToken);
  -                } catch (ObjectIsAlreadyLockedException e) {
  -                    // Silent catch
  -                }
  -                
  -                try {
  -                    lockToken = new NodeLock
  -                        (lockToken,
  -                         namespaceConfig.getRemoveRevisionMetadataAction()
  -                         .getUri());
  -                    lock.lock(slideToken, lockToken);
  -                } catch (ObjectIsAlreadyLockedException e) {
  -                    // Silent catch
  -                }
  -                
  -                try {
  -                    lockToken = new NodeLock
  -                        (lockToken,
  -                         namespaceConfig.getModifyRevisionContentAction()
  -                         .getUri());
  -                    lock.lock(slideToken, lockToken);
  -                } catch (ObjectIsAlreadyLockedException e) {
  -                    // Silent catch
  -                }
  -                
  -                try {
  -                    lockToken = new NodeLock
  -                        (lockToken,
  -                         namespaceConfig.getRemoveRevisionContentAction()
  -                         .getUri());
  -                    lock.lock(slideToken, lockToken);
  -                } catch (ObjectIsAlreadyLockedException e) {
  -                    // Silent catch
  -                }
  -                
  -                try {
  +                    if (lockDate == null)
  +                        lockDate = new Date((new Date()).getTime()
  +                                                + (lockDuration * 1000));
  +
                       lockToken =
  -                        new NodeLock(lockToken,
  -                                     namespaceConfig.getRemoveObjectAction()
  -                                     .getUri());
  +                        new NodeLock(toLockSubject, credentialsSubject,
  +                                     namespaceConfig.getCreateObjectAction(),
  +                                     lockDate, inheritance, exclusive, lockInfo_lockOwner);
                       lock.lock(slideToken, lockToken);
  -                } catch (ObjectIsAlreadyLockedException e) {
  -                    // Silent catch
  -                }
  -                
  +
  +                    try {
  +                        lockToken = new NodeLock
  +                            (lockToken,
  +                             namespaceConfig.getCreateRevisionMetadataAction()
  +                                 .getUri());
  +                        lock.lock(slideToken, lockToken);
  +                    } catch (ObjectIsAlreadyLockedException e) {
  +                        // Silent catch
  +                    }
  +
  +                    try {
  +                        lockToken = new NodeLock
  +                            (lockToken,
  +                             namespaceConfig.getModifyRevisionMetadataAction()
  +                                 .getUri());
  +                        lock.lock(slideToken, lockToken);
  +                    } catch (ObjectIsAlreadyLockedException e) {
  +                        // Silent catch
  +                    }
  +
  +                    try {
  +                        lockToken = new NodeLock
  +                            (lockToken,
  +                             namespaceConfig.getRemoveRevisionMetadataAction()
  +                                 .getUri());
  +                        lock.lock(slideToken, lockToken);
  +                    } catch (ObjectIsAlreadyLockedException e) {
  +                        // Silent catch
  +                    }
  +
  +                    try {
  +                        lockToken = new NodeLock
  +                            (lockToken,
  +                             namespaceConfig.getModifyRevisionContentAction()
  +                                 .getUri());
  +                        lock.lock(slideToken, lockToken);
  +                    } catch (ObjectIsAlreadyLockedException e) {
  +                        // Silent catch
  +                    }
  +
  +                    try {
  +                        lockToken = new NodeLock
  +                            (lockToken,
  +                             namespaceConfig.getRemoveRevisionContentAction()
  +                                 .getUri());
  +                        lock.lock(slideToken, lockToken);
  +                    } catch (ObjectIsAlreadyLockedException e) {
  +                        // Silent catch
  +                    }
  +
  +                    try {
  +                        lockToken =
  +                            new NodeLock(lockToken,
  +                                         namespaceConfig.getRemoveObjectAction()
  +                                             .getUri());
  +                        lock.lock(slideToken, lockToken);
  +                    } catch (ObjectIsAlreadyLockedException e) {
  +                        // Silent catch
  +                    }
  +
                   // Set the lock-token header
  -                // [RFC 2518, 9.5] " The Lock-Token response header is used 
  -                // with the LOCK method to indicate the lock token created as 
  -                // a result of a successful LOCK request to create a new 
  +                // [RFC 2518, 9.5] " The Lock-Token response header is used
  +                // with the LOCK method to indicate the lock token created as
  +                // a result of a successful LOCK request to create a new
                   // lock."
                   resp.setHeader("Lock-Token",
                                  "opaquelocktoken:" + lockToken.getLockId());
  -                
  -                resp.setStatus(WebdavStatus.SC_OK);
  -                
  -                // The lock token on which the DAV module will have the info
  -                
  -                showLockDiscoveryInfo(lockToken);
  -                
  -            } catch (ObjectIsAlreadyLockedException e) {
  -                if (inheritance && generate207Response(isCollection, e, requestUri)) {
  -                    // error is on the resource which we attempted to lock
  -                    String errorMessage = generateErrorMessage(e);
  -                    // Write it on the servlet writer
  +
  +                    resp.setStatus(WebdavStatus.SC_OK);
  +
  +                    // The lock token on which the DAV module will have the info
  +
  +                    showLockDiscoveryInfo(lockToken);
  +
  +                } catch (ObjectIsAlreadyLockedException e) {
  +                    if (inheritance && generateMultiStatusResponse(isCollection, e, requestUri)) {
  +                        // error is on the resource which we attempted to lock
  +                        String errorMessage = generateErrorMessage(e);
  +                        // Write it on the servlet writer
                           resp.setContentType(TEXT_XML_UTF_8);
  -                    resp.setStatus(WebdavStatus.SC_MULTI_STATUS);
  -                    try {
  -                        resp.getWriter().write(errorMessage);
  -                    } catch(IOException ex) {
  -                        // Critical error ... Servlet container is dead or something
  +                        resp.setStatus(WebdavStatus.SC_MULTI_STATUS);
  +                        try {
  +                            resp.getWriter().write(errorMessage);
  +                        } catch(IOException ex) {
  +                            // Critical error ... Servlet container is dead or something
                               int statusCode = WebdavStatus.SC_INTERNAL_SERVER_ERROR;
                               sendError( statusCode, e );
                               throw new WebdavException( statusCode );
  +                        }
  +                    } else {
  +                        // Returning 207 on non-collection requests is generally
  +                        // considered bad. So let's not do it, since this way
  +                        // makes clients generally behave better.
  +                        resp.setStatus(WebdavStatus.SC_LOCKED);
                       }
  -                } else {
  -                    // Returning 207 on non-collection requests is generally
  -                    // considered bad. So let's not do it, since this way
  -                    // makes clients generally behave better.
  -                    resp.setStatus(WebdavStatus.SC_LOCKED);
  -                }
  -                //
  -                // make sure the transaction is aborted
  -                // throw any WebDAV exception to indicate the transaction wants to be aborted
  -                //
  -                throw new WebdavException(WebdavStatus.SC_ACCEPTED, false);
  -            } catch (Exception e) {
  +                    //
  +                    // make sure the transaction is aborted
  +                    // throw any WebDAV exception to indicate the transaction wants to be aborted
  +                    //
  +                    throw new WebdavException(WebdavStatus.SC_ACCEPTED, false);
  +                } catch (Exception e) {
                       int statusCode = getErrorCode( e );
                       sendError( statusCode, e );
                       throw new WebdavException( statusCode );
  -            }
  -            
  -            break;
  -            
  -        case LOCK_REFRESH:
  -            
  -            try {
  -                
  -                Enumeration lockTokens =
  -                    lock.enumerateLocks(slideToken, lockInfo_lockSubject, false);
  -                
  -                NodeLock currentLockToken = null;
  -                Date newExpirationDate =
  -                    new Date((new Date()).getTime() + (lockDuration * 1000));
  -                while (lockTokens.hasMoreElements()) {
  -                    currentLockToken = (NodeLock) lockTokens.nextElement();
  -                    lock.renew(slideToken, currentLockToken,
  -                               newExpirationDate);
                   }
  -                
  -                showLockDiscoveryInfo(currentLockToken);
  -                
  -            } catch (SlideException e) {
  +
  +                break;
  +
  +            case LOCK_REFRESH:
  +
  +                try {
  +
  +                    Enumeration lockTokens =
  +                        lock.enumerateLocks(slideToken, lockInfo_lockSubject, false);
  +
  +                    NodeLock currentLockToken = null;
  +                    Date newExpirationDate =
  +                        new Date((new Date()).getTime() + (lockDuration * 1000));
  +                    while (lockTokens.hasMoreElements()) {
  +                        currentLockToken = (NodeLock) lockTokens.nextElement();
  +                        lock.renew(slideToken, currentLockToken,
  +                                   newExpirationDate);
  +                    }
  +
  +                    showLockDiscoveryInfo(currentLockToken);
  +
  +                } catch (SlideException e) {
                       int statusCode = WebdavStatus.SC_PRECONDITION_FAILED;
                       sendError( statusCode, e );
                       throw new WebdavException( statusCode );
  -            }
  -            
  -            break;
  -            
  +                }
  +
  +                break;
  +
           }
  -        
  +
       }
  -    
  -    
  -        
  -        
  -        
  +
  +
  +
  +
  +
       /**
        * Get return status based on exception type.
        */
  @@ -657,7 +657,7 @@
           }
       }
   
  -    
  +
       /**
        * Show lockdiscovery info.
        *
  @@ -665,19 +665,19 @@
        */
       protected void showLockDiscoveryInfo(NodeLock token)
           throws WebdavException {
  -        
  +
           // Generating XML response
           org.jdom.Element prop = new org.jdom.Element(E_PROP, NamespaceCache.DEFAULT_NAMESPACE);
           org.jdom.Element lockdiscovery = new org.jdom.Element(E_LOCKDISCOVERY, NamespaceCache.DEFAULT_NAMESPACE);
           prop.addContent(lockdiscovery);
           XMLValue xmlValue = propertyHelper.computeLockDiscovery(token,
  -                                                             serverURL,
  -                                                             req.getContextPath());
  +                                                                serverURL,
  +                                                                req.getContextPath());
           Iterator iterator = xmlValue.iterator();
           while (iterator.hasNext()) {
               lockdiscovery.addContent((org.jdom.Element)iterator.next());
           }
  -        
  +
           try {
               //System.out.println("Query result");
               //System.out.println(generatedXML.toString());
  @@ -690,19 +690,19 @@
               sendError( statusCode, e );
               throw new WebdavException( statusCode );
           }
  -        
  -        
  +
  +
       }
  -   
  -    
  +
  +
       /**
        * Returns true
        */
       protected boolean methodNeedsTransactionSupport() {
           return true;
       }
  -    
  -   
  +
  +
   }
   
   
  
  
  
  1.57      +6 -6      jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/MoveMethod.java
  
  Index: MoveMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/MoveMethod.java,v
  retrieving revision 1.56
  retrieving revision 1.57
  diff -u -r1.56 -r1.57
  --- MoveMethod.java	14 Feb 2003 14:34:34 -0000	1.56
  +++ MoveMethod.java	21 May 2003 15:49:46 -0000	1.57
  @@ -218,7 +218,7 @@
                   resp.setStatus(WebdavStatus.SC_CREATED);
               }
           } catch (MacroException e) {
  -            if(generate207Response(isCollection, e, requestUri)) {
  +            if(generateMultiStatusResponse(isCollection, e, requestUri)) {
                   String errorMessage = generateErrorMessage(e);
                   // Write it on the servlet writer
                   resp.setStatus(WebdavStatus.SC_MULTI_STATUS);
  @@ -259,9 +259,9 @@
               throw new WebdavException(WebdavStatus.SC_ACCEPTED, false);
           }
           catch (SlideException e) {
  -            int statusCode = getErrorCode(e);
  +            int statusCode = getErrorCode( e );
               sendError( statusCode, e );
  -            throw new WebdavException(statusCode);
  +            throw new WebdavException( statusCode );
           }
       }
       
  
  
  
  1.33      +4 -10     jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/OptionsMethod.java
  
  Index: OptionsMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/OptionsMethod.java,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- OptionsMethod.java	18 Mar 2003 11:36:14 -0000	1.32
  +++ OptionsMethod.java	21 May 2003 15:49:46 -0000	1.33
  @@ -132,13 +132,7 @@
           
           if( req.getContentLength() > 0 ) {
               try {
  -                Element oe = parseRequestContent().getRootElement();
  -                if( oe == null || !oe.getName().equals(E_OPTIONS) ) {
  -                    int statusCode = WebdavStatus.SC_BAD_REQUEST;
  -                    sendError( statusCode, getClass().getName()+".missingRootElement", new Object[]{"DAV:"+E_OPTIONS} );
  -                    throw new WebdavException( statusCode );
  -                }
  -                Iterator i = oe.getChildren().iterator();
  +                Iterator i = parseRequestContent(E_OPTIONS).getChildren().iterator();
                   while( i.hasNext() ) {
                       Element e = (Element)i.next();
                       if( e.getName().equals(E_VERSION_HISTORY_COLLECTION_SET) )
  
  
  
  1.89      +4 -10     jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PropFindMethod.java
  
  Index: PropFindMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PropFindMethod.java,v
  retrieving revision 1.88
  retrieving revision 1.89
  diff -u -r1.88 -r1.89
  --- PropFindMethod.java	14 Feb 2003 14:34:34 -0000	1.88
  +++ PropFindMethod.java	21 May 2003 15:49:46 -0000	1.89
  @@ -242,13 +242,7 @@
   
               try {
   
  -                Element element = parseRequestContent().getRootElement();
  -                if ( (element == null) ||  ! element.getName().equalsIgnoreCase(E_PROPFIND)) {
  -                    int statusCode = WebdavStatus.SC_BAD_REQUEST;
  -                    sendError( statusCode, getClass().getName()+".missingRootElement", new Object[]{"DAV:"+E_PROPFIND} );
  -                    throw new WebdavException( statusCode );
  -                }
  -
  +                Element element = parseRequestContent(E_PROPFIND);
                   try {
                       element = (Element)element.getChildren().get(0);
                   }
  
  
  
  1.66      +8 -19     jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PropPatchMethod.java
  
  Index: PropPatchMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PropPatchMethod.java,v
  retrieving revision 1.65
  retrieving revision 1.66
  diff -u -r1.65 -r1.66
  --- PropPatchMethod.java	13 May 2003 12:48:01 -0000	1.65
  +++ PropPatchMethod.java	21 May 2003 15:49:46 -0000	1.66
  @@ -182,18 +182,7 @@
           if (requestBody.length() != 0) {
               
               try {
  -                
  -                Element setNode = null;
  -                Element removeNode = null;
  -                
  -                Document document = parseRequestContent();
  -                
  -                // Get the root element of the document
  -                Element rootElement = document.getRootElement();
  -                if ( (rootElement == null) || ( ! E_PROPERTYUPDATE.equals(rootElement.getName()) ) ) {
  -                    throw new JDOMException("<"+E_PROPERTYUPDATE+"> element missing");
  -                }
  -                Iterator childrenIterator = rootElement.getChildren().iterator();
  +                Iterator childrenIterator = parseRequestContent(E_PROPERTYUPDATE).getChildren().iterator();
                   Element child = null;
                   while (childrenIterator.hasNext()) {
                       child = (Element)childrenIterator.next();
  @@ -427,9 +416,9 @@
               }
               
               if ( result && !isSupportedPropertyValue(property, resourceKind) ) {
  -                    property.setErrorMessage("Value " + property.getValue() + " is not supported by property " + property.getQualifiedNameAsElementString());
  -                    result = false;
  -                }
  +                property.setErrorMessage("Value " + property.getValue() + " is not supported by property " + property.getQualifiedNameAsElementString());
  +                result = false;
  +            }
               
               if (!result) property.setStatusCode(WebdavStatus.SC_CONFLICT);
           }
  @@ -528,7 +517,7 @@
               response.addContent(propstat);
               if (property.getViolatedPrecondition() != null) {
                   Element responseDescription = new Element(E_RESPONSEDESCRIPTION, NamespaceCache.DEFAULT_NAMESPACE);
  -                responseDescription.addContent(getPreconditionViolationError(property.getViolatedPrecondition()));
  +                responseDescription.addContent(MethodUtil.getPreconditionViolationError(property.getViolatedPrecondition()));
                   propstat.addContent(responseDescription);
               }
               else if (property.getErrorMessage() != null) {
  
  
  
  1.51      +5 -5      jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/ReportMethod.java
  
  Index: ReportMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/ReportMethod.java,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- ReportMethod.java	14 May 2003 16:15:20 -0000	1.50
  +++ ReportMethod.java	21 May 2003 15:49:46 -0000	1.51
  @@ -293,7 +293,7 @@
           try{
               
               // check if Report request contains a content
  -            Document content = parseRequestContent();
  +            Document content = parseRequestContent(); // TODO: merge with parseRequestContent(rootName)
               Element element = content.getRootElement();
               
               if (element == null) {
  
  
  
  1.31      +4 -4      jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/SearchMethod.java
  
  Index: SearchMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/SearchMethod.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- SearchMethod.java	14 Feb 2003 14:34:35 -0000	1.30
  +++ SearchMethod.java	21 May 2003 15:49:46 -0000	1.31
  @@ -317,7 +317,7 @@
           Element queryElement = null;
           try
           {
  -            Document document = parseRequestContent();
  +            Document document = parseRequestContent(); // TODO: check root element name
               Element rootElement = document.getRootElement();
               List children = rootElement.getChildren();
               if (children.size() > 0) {
  
  
  
  1.15      +86 -86    jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/UpdateMethod.java
  
  Index: UpdateMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/UpdateMethod.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- UpdateMethod.java	14 Feb 2003 14:34:35 -0000	1.14
  +++ UpdateMethod.java	21 May 2003 15:49:46 -0000	1.15
  @@ -118,42 +118,42 @@
    * @author <a href="mailto:peter.nevermann@softwareag.com">Peter Nevermann</a>
    */
   public class UpdateMethod extends AbstractMultistatusResponseMethod
  -implements DeltavConstants {
  -    
  +    implements DeltavConstants {
  +
       /** The update target */
       private String resourcePath;
   
       /** The update source */
       private String updateSourcePath;
  -    
  +
       /** The label of the update source */
       private String updateLabelName;
  -    
  +
       /** Requested properties */
       private RequestedProperties requestedProps;
  -    
  +
       /**
        * The VersioningHelper used by this instance.
        */
       protected VersioningHelper versioningHelper = null;
  -    
  +
       /**
        * The URI of the server, e.g. <code>localhost:4000</code>.
        */
       protected String serverUri = null;
  -    
  +
       /**
        * The PropertyRetriever used to retrieve any requested properties.
        */
       protected PropertyRetriever propertyRetriever = null;
  -    
  -    
  +
  +
       // ----------------------------------------------------------- Constructors
  -    
  -    
  +
  +
       /**
        * Constructor.
  -     * 
  +     *
        * @param token     the token for accessing the namespace
        * @param config    configuration of the WebDAV servlet
        */
  @@ -161,31 +161,31 @@
                           WebdavServletConfig config) {
           super(token, config);
       }
  -    
  +
       /**
        * Parse WebDAV XML query.
        *
        * @exception WebdavException
        */
       protected void parseRequest() throws WebdavException {
  -        
  +
           versioningHelper =  VersioningHelper.getVersioningHelper(
               slideToken, token, req, resp, getConfig() );
           readRequestContent();
           serverUri = req.getServerName() + ":" + req.getServerPort();
           propertyRetriever = new PropertyRetrieverImpl(token, slideToken, getConfig());
  -        
  +
           resourcePath = requestUri;
           if (resourcePath == null) {
               resourcePath = "/";
           }
  -        
  +
           if( req.getContentLength() == 0 ) {
               int statusCode = WebdavStatus.SC_BAD_REQUEST;
               sendError( statusCode, getClass().getName()+".missingRequestBody" );
               throw new WebdavException( statusCode );
           }
  -        
  +
           try{
               parseUpdateRequestContent();
           }
  @@ -205,7 +205,7 @@
               throw new WebdavException( statusCode );
           }
       }
  -    
  +
       /**
        * Parses the expected request content specified for the Update method.
        *
  @@ -214,69 +214,69 @@
        * @throws      PropertyParseException  if parsing the property fails for any reason.
        */
       private void parseUpdateRequestContent() throws IOException, JDOMException, PropertyParseException {
  -        
  +
           Element ue = parseRequestContent().getRootElement();
  -            Element ve = null;
  -            if( ue == null || !ue.getName().equals(E_UPDATE) ) {
  +        Element ve = null;
  +        if( ue == null || !ue.getName().equals(E_UPDATE) ) {
               throw new JDOMException("Root element must be &lt;"+E_UPDATE+"&gt;");
  -            }
  -            Iterator i = ue.getChildren().iterator();
  -            while( i.hasNext() ) {
  -                Element e = (Element)i.next();
  -                if( e.getName().equals(E_VERSION) ) {
  -                    if( updateSourcePath != null ) {
  +        }
  +        Iterator i = ue.getChildren().iterator();
  +        while( i.hasNext() ) {
  +            Element e = (Element)i.next();
  +            if( e.getName().equals(E_VERSION) ) {
  +                if( updateSourcePath != null ) {
                       throw new JDOMException("At most one &lt;"+E_VERSION+"&gt; element allowed" );
                   }
                   if (updateLabelName != null) {
                       throw new JDOMException("Either a &lt;"+E_VERSION+"&gt; OR a &lt;"+E_LABEL_NAME+"&gt; element allowed");
  -                    }
  -                    // get the href element
  -                    ve = e;
  -                    try {
  -                        Element hre = (Element)ve.getChildren().get(0);
  -                        if( hre == null || !hre.getName().equals(E_HREF) )
  -                            throw new Exception();
  -                        updateSourcePath = getSlidePath( hre.getText() );
  -                    }
  -                    catch( Exception x ) {
  +                }
  +                // get the href element
  +                ve = e;
  +                try {
  +                    Element hre = (Element)ve.getChildren().get(0);
  +                    if( hre == null || !hre.getName().equals(E_HREF) )
  +                        throw new Exception();
  +                    updateSourcePath = getSlidePath( hre.getText() );
  +                }
  +                catch( Exception x ) {
                       throw new JDOMException("&lt;"+E_VERSION+"&gt; element must contain &lt;"+E_HREF+"&gt; element" );
  -                    }
                   }
  -                if( e.getName().equals(E_PROP) ) {
  -                    if( requestedProps != null ) {
  +            }
  +            if( e.getName().equals(E_PROP) ) {
  +                if( requestedProps != null ) {
                       throw new JDOMException("At most one "+E_PROP+" element allowed" );
  -                    }
  -                    requestedProps = new RequestedPropertiesImpl( e );
                   }
  +                requestedProps = new RequestedPropertiesImpl( e );
  +            }
               if( e.getName().equals(E_LABEL_NAME) ) {
                   if (updateSourcePath != null) {
                       throw new JDOMException("Either a &lt;"+E_VERSION+"&gt; OR a &lt;"+E_LABEL_NAME+"&gt; element allowed");
  -            }
  +                }
                   if( updateLabelName != null ) {
                       throw new JDOMException("At most one &lt;"+E_LABEL_NAME+"&gt; element allowed" );
  -        }
  +                }
                   updateLabelName = e.getText();
  -        }
  +            }
           }
       }
  -    
  +
       /**
        * Execute the request.
        *
        * @exception WebdavException
        */
       protected void executeRequest() throws WebdavException, IOException {
  -        
  +
           // Prevent dirty reads
           slideToken.setForceStoreEnlistment(true);
  -        
  -            Element multistatusElement = new Element(E_MULTISTATUS, NamespaceCache.DEFAULT_NAMESPACE);
  -            
  +
  +        Element multistatusElement = new Element(E_MULTISTATUS, NamespaceCache.DEFAULT_NAMESPACE);
  +
           try {
               update(updateSourcePath, updateLabelName, resourcePath, getDepth(), multistatusElement);
           }
           catch (NestedSlideException nestedSlideException) {
  -            
  +
               if ( (req.getHeader(H_DEPTH) == null) || (req.getHeader(H_DEPTH).length() == 0) ) {
                   // do not send a 207 multistatus if the depth header is not set
                   SlideException exception = (SlideException)nestedSlideException.enumerateExceptions().nextElement();
  @@ -294,7 +294,7 @@
                   throw new WebdavException(getErrorCode(exception), false); // abort the TA
               }
           }
  -            
  +
           try {
               resp.setStatus(WebdavStatus.SC_MULTI_STATUS);
               resp.setContentType(TEXT_XML_UTF_8);
  @@ -307,7 +307,7 @@
               throw new WebdavException( statusCode );
           }
       }
  -    
  +
       /**
        * Updates the resource identified by <code>resourcePath</code>
        * with the properties and the content either of the resource identified
  @@ -332,8 +332,8 @@
               throw nestedSlideException;
           }
       }
  -    
  -    
  +
  +
       /**
        * Updates the resource identified by <code>resourcePath</code>
        * with the properties and the content either of the resource identified
  @@ -352,7 +352,7 @@
        *                                 elements to.
        */
       protected void update(String updateSourcePath, String updateLabelName, String resourcePath, int depth, Element multistatusElement, NestedSlideException nestedSlideException) {
  -        
  +
           Element responseElement = new Element(E_RESPONSE, NamespaceCache.DEFAULT_NAMESPACE);
           multistatusElement.addContent(responseElement);
           Element hrefElement = new Element(E_HREF, NamespaceCache.DEFAULT_NAMESPACE);
  @@ -360,26 +360,26 @@
           responseElement.addContent(hrefElement);
           Element statusElement = new Element(E_STATUS, NamespaceCache.DEFAULT_NAMESPACE);
           responseElement.addContent(statusElement);
  -        
  +
           Enumeration childrenEnum = null;
           try {
               if ( isCollection(resourcePath) && (depth > 0) ) {
                   ObjectNode currentNode = structure.retrieve(slideToken, resourcePath);
                   childrenEnum = structure.getChildren(slideToken, currentNode);
  -    }
  -            
  +            }
  +
               checkPreconditions(updateSourcePath, updateLabelName, resourcePath);
  -            
  +
               if (updateLabelName != null) {
                   updateSourcePath = versioningHelper.getLabeledResourceUri(resourcePath,
                                                                             updateLabelName);
               }
  -            
  +
               versioningHelper.update( resourcePath, updateSourcePath );
               statusElement.setText(HTTP_VERSION + " " +
                                         WebdavStatus.SC_OK  + " " +
                                         WebdavStatus.getStatusText(WebdavStatus.SC_OK));
  -            
  +
               appendRequestedProps(resourcePath, responseElement);
           }
           catch (SlideException e) {
  @@ -428,7 +428,7 @@
           }
       }
   
  -    
  +
       /**
        * Checks the preconditions of the Update method.
        *
  @@ -449,14 +449,14 @@
           }
       }
   
  -    
  +
       /**
        * Sets the appropriate status text and appends a &lt;responsedescription&gt;
        * element if a precondition has been violated.
        *
        * @param      exception             the JDOMException that occurred.
  -     * @param      statusElement    the &lt;status&gt; element.
  -     * @param      responseElement  the &lt;response&gt; element.
  +     * @param      statusElement         the &lt;status&gt; element.
  +     * @param      responseElement       the &lt;response&gt; element.
        * @param      nestedSlideException  the NestedSlideException to add the exception to.
        */
       private void handleException(JDOMException exception, Element statusElement, Element responseElement, NestedSlideException nestedSlideException) {
  @@ -465,7 +465,7 @@
                           responseElement,
                           nestedSlideException);
       }
  -    
  +
       /**
        * Sets the appropriate status text and appends a &lt;responsedescription&gt;
        * element if a precondition has been violated.
  @@ -476,7 +476,7 @@
        * @param      nestedSlideException  the NestedSlideException to add the exception to.
        */
       private void handleException(SlideException exception, Element statusElement, Element responseElement, NestedSlideException nestedSlideException) {
  -        
  +
           nestedSlideException.addException(exception);
   
           int errorCode = getErrorCode(exception);
  @@ -486,12 +486,12 @@
               Element responseDescriptionElement = new Element(E_RESPONSEDESCRIPTION,
                                                                NamespaceCache.DEFAULT_NAMESPACE);
               responseElement.addContent(responseDescriptionElement);
  -            Element errorElement = getPreconditionViolationError(((PreconditionViolationException)exception).getViolatedPrecondition());
  +            Element errorElement = MethodUtil.getPreconditionViolationError(((PreconditionViolationException)exception).getViolatedPrecondition());
               responseDescriptionElement.addContent(errorElement);
           }
       }
  -    
  -    
  +
  +
       /**
        * Checks the (DeltaV) preconditions
        * <ul>
  @@ -508,9 +508,9 @@
        * @throws     SlideException
        */
       protected ViolatedPrecondition getPreconditionViolation(String updateSourcePath, String updateSourceLabel, String resourcePath) throws SlideException {
  -        
  +
           ViolatedPrecondition violatedPrecondition = null;
  -        
  +
           NodeRevisionDescriptors revisionDescriptors =
               content.retrieve(slideToken, resourcePath);
           NodeRevisionDescriptor revisionDescriptor =
  @@ -522,7 +522,7 @@
               return new ViolatedPrecondition(DeltavConstants.C_MUST_BE_CHECKED_IN_VERSION_CONTROLLED_RESOURCE,
                                               WebdavStatus.SC_CONFLICT);
           }
  -        
  +
           if (updateSourceLabel != null) {
               try {
                   updateSourcePath = versioningHelper.getLabeledResourceUri(resourcePath, updateLabelName);
  @@ -532,14 +532,14 @@
                                                   WebdavStatus.SC_CONFLICT);
               }
           }
  -        
  +
           String associatedVrUri = versioningHelper.getUriOfAssociatedVR(resourcePath);
           String vcrHistoryUri = UriHandler.getUriHandler(associatedVrUri).getAssociatedHistoryUri();
           UriHandler vrUriHandler = UriHandler.getUriHandler(updateSourcePath);
           boolean isVersionOfVcrHistory = false;
           if (vrUriHandler.isVersionUri() &&
               vcrHistoryUri.equals(vrUriHandler.getAssociatedHistoryUri()) ) {
  -            
  +
               NodeRevisionDescriptors vrDescriptors =
                   content.retrieve(slideToken, updateSourcePath);
               try {
  @@ -550,16 +550,16 @@
               catch (RevisionDescriptorNotFoundException e) {
               }
           }
  -        
  +
           if ( ! isVersionOfVcrHistory ) {
               return new ViolatedPrecondition(DeltavConstants.C_MUST_SELECT_VERSION_IN_HISTORY,
                                               WebdavStatus.SC_CONFLICT);
           }
  -        
  +
           return violatedPrecondition;
       }
  -    
  -    
  +
  +
       /**
        * Returns the value of the <code>Depth</code> header. If not specified,
        * <code>0</code> is used as default.
  @@ -567,7 +567,7 @@
        * @return     the value of the <code>Depth</code> header.
        */
       protected int getDepth() {
  -        
  +
           int depth = 0;
           try {
               depth = Integer.parseInt(req.getHeader(H_DEPTH));
  @@ -575,8 +575,8 @@
           catch (NumberFormatException e) {}
           return depth;
       }
  -    
  -    
  +
  +
   }
   
   
  
  
  
  1.21      +4 -9      jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/VersionControlMethod.java
  
  Index: VersionControlMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/VersionControlMethod.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- VersionControlMethod.java	14 Oct 2002 16:03:42 -0000	1.20
  +++ VersionControlMethod.java	21 May 2003 15:49:46 -0000	1.21
  @@ -130,13 +130,8 @@
           
           if( req.getContentLength() > 0 ) {
               try{
  -                Element vce = parseRequestContent().getRootElement();
                   Element ve = null;
  -                if( vce == null || !vce.getName().equals(E_VERSION_CONTROL) ) {
  -                    Domain.warn( "Root element must be "+E_VERSION_CONTROL );
  -                    throw new JDOMException("Root element must be <"+E_VERSION_CONTROL+">");
  -                }
  -                Iterator i = vce.getChildren().iterator();
  +                Iterator i = parseRequestContent(E_VERSION_CONTROL).getChildren().iterator();
                   while( i.hasNext() ) {
                       Element e = (Element)i.next();
                       if( e.getName().equals(E_VERSION) ) {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org