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 re...@locus.apache.org on 2000/09/20 08:06:19 UTC

cvs commit: jakarta-slide/src/share/org/apache/slide/webdav/method LockMethod.java PutMethod.java WebdavMethod.java

remm        00/09/19 23:06:19

  Modified:    .        build.xml
               src/share/org/apache/slide/lock NodeLock.java
               src/share/org/apache/slide/store
                        ContentStoreFilesystemImpl.java
               src/share/org/apache/slide/webdav WebdavServlet.java
               src/share/org/apache/slide/webdav/common
                        WebdavXMLPrinter.java
               src/share/org/apache/slide/webdav/method LockMethod.java
                        PutMethod.java WebdavMethod.java
  Added:       src/share/org/apache/slide/util MD5Encoder.java
  Log:
  - A standalone DAV server is no longer included. It can still be
    built using the "standalone-dist" target.
  - The WAR web application is now the default way of deploying
    Slide.
  - Lock-null resources should now work with the filesystem store.
  - Fix to the lock discovery info returned by lock, so that Office
    2000 behaves correctly.
  - Enhanced lock token generation.
  - If header parsing (rudimentary).
  - XML writer bug fix.
  
  Revision  Changes    Path
  1.42      +32 -7     jakarta-slide/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/build.xml,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- build.xml	2000/09/19 04:21:04	1.41
  +++ build.xml	2000/09/20 06:06:15	1.42
  @@ -380,6 +380,28 @@
   
   
     <!-- =================================================================== -->
  +  <!-- Build Catalina related components                                   -->
  +  <!-- This target requires Tomcat 4.0                                     -->
  +  <!-- =================================================================== -->
  +  <target name="catalina-util" depends="no-debug">
  +    
  +    <javac srcdir="src/clients/tomcat" 
  +     destdir="${slide.build}/classes"
  +     debug="off" deprecation="off" 
  +     includes="**/org/apache/catalina/**"
  +     excludes="**/CVS/**"
  +     classpath="${slide.build}/classes:${catalina.build}/classes" />
  +    <copyfile src="src/etc/MANIFEST.MF" 
  +     dest="${slide.build}/classes/MANIFEST.MF" />
  +    <replace  file="${slide.build}/classes/MANIFEST.MF" 
  +     token="$$VERSION$$" value="${version}" />
  +    <copydir  src="src/etc" 
  +     dest="${slide.build}/classes" 
  +     includes="LICENSE,README,CHANGELOG" />
  +    
  +  </target>
  +
  +  <!-- =================================================================== -->
     <!-- Build a standalone Slide server                                     -->
     <!-- This target requires Tomcat 4.0                                     -->
     <!-- =================================================================== -->
  @@ -550,10 +572,10 @@
     <!-- =================================================================== -->
     <target name="release-prepare">
       <mkdir dir="${slide.release}" />
  -    <mkdir dir="${slide.release}/standalone-avalon" />
  +    <mkdir dir="${slide.release}/avalon" />
       <mkdir dir="${slide.release}/slide" />
       <mkdir dir="${slide.release}/client" />
  -    <mkdir dir="${slide.release}/standalone" />
  +    <mkdir dir="${slide.release}/catalina" />
       <mkdir dir="${slide.release}/webapp" />
     </target>
     
  @@ -561,18 +583,21 @@
     <!-- =================================================================== -->
     <!-- Release                                                             -->
     <!-- =================================================================== -->
  -  <target name="release" depends="dist, doc, standalone-dist, 
  -   webdav-client-dist, webapp-dist, release-prepare">
  +  <target name="release" depends="dist, doc, webdav-client-dist, webapp-dist, 
  +   catalina-util, release-prepare">
       <!--copydir src="${avalon.dist}" 
  -     dest="${slide.release}/standalone-avalon" /-->
  +     dest="${slide.release}/avalon" /-->
       <copydir src="${webdavclient.dist}" dest="${slide.release}/client" />
       <copydir src="${slide.dist}" dest="${slide.release}/slide" />
  -    <copydir src="${dav.dist}" dest="${slide.release}/standalone" />
       <jar jarfile="${slide.release}/webapp/slide.war" 
        basedir="${webapp.dist}" includes="**"/>
       <copydir src="." dest="${slide.release}" 
        includes="LICENSE,README,CHANGELOG,RELEASE-INFO,RELEASE-PLAN,STATUS.html" 
  -    />
  +     />
  +    <jar jarfile="${slide.release}/catalina/catalinautil.jar" 
  +     basedir="${slide.build}/classes"
  +     manifest="${slide.build}/classes/MANIFEST.MF" 
  +     includes="LICENSE,README,CHANGELOG,org/apache/catalina/**" />
     </target>
     
     
  
  
  
  1.3       +37 -4     jakarta-slide/src/share/org/apache/slide/lock/NodeLock.java
  
  Index: NodeLock.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/lock/NodeLock.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- NodeLock.java	2000/09/05 05:38:09	1.2
  +++ NodeLock.java	2000/09/20 06:06:15	1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/lock/NodeLock.java,v 1.2 2000/09/05 05:38:09 remm Exp $
  - * $Revision: 1.2 $
  - * $Date: 2000/09/05 05:38:09 $
  + * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/lock/NodeLock.java,v 1.3 2000/09/20 06:06:15 remm Exp $
  + * $Revision: 1.3 $
  + * $Date: 2000/09/20 06:06:15 $
    *
    * ====================================================================
    *
  @@ -64,14 +64,17 @@
   package org.apache.slide.lock;
   
   import java.util.Date;
  +import java.security.MessageDigest;
  +import java.security.NoSuchAlgorithmException;
   import org.apache.slide.common.*;
   import org.apache.slide.structure.*;
  +import org.apache.slide.util.MD5Encoder;
   
   /**
    * NodeLock class.
    * 
    * @author <a href="mailto:remm@exoffice.com">Remy Maucherat</a>
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    */
   public final class NodeLock implements Cloneable {
       
  @@ -155,6 +158,8 @@
           this.lockId = objectUri.hashCode() + "_" + subjectUri.hashCode() + "_" 
               + typeUri.hashCode() + "_" + expirationDate.getTime() + "_" 
               + (new Date()).getTime();
  +        this.lockId = 
  +            md5Encoder.encode(md5Helper.digest(this.lockId.getBytes()));
           this.exclusive = exclusive;
       }
       
  @@ -237,6 +242,34 @@
        * Lock Id.
        */
       protected String lockId;
  +    
  +    
  +    /**
  +     * MD5 message digest provider.
  +     */
  +    protected static MessageDigest md5Helper;
  +
  +
  +    /**
  +     * The MD5 helper object for this class.
  +     */
  +    protected static final MD5Encoder md5Encoder = new MD5Encoder();
  +
  +
  +    // ------------------------------------------------------------ Initializer
  +    
  +    
  +    static {
  +        
  +        // Load the MD5 helper used to calculate signatures.
  +        try {
  +            md5Helper = MessageDigest.getInstance("MD5");
  +        } catch (NoSuchAlgorithmException e) {
  +            e.printStackTrace();
  +            throw new IllegalStateException();
  +        }
  +        
  +    }
       
       
       // ------------------------------------------------------------- Properties
  
  
  
  1.5       +15 -5     jakarta-slide/src/share/org/apache/slide/store/ContentStoreFilesystemImpl.java
  
  Index: ContentStoreFilesystemImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/store/ContentStoreFilesystemImpl.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ContentStoreFilesystemImpl.java	2000/08/02 04:28:07	1.4
  +++ ContentStoreFilesystemImpl.java	2000/09/20 06:06:16	1.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/store/ContentStoreFilesystemImpl.java,v 1.4 2000/08/02 04:28:07 remm Exp $
  - * $Revision: 1.4 $
  - * $Date: 2000/08/02 04:28:07 $
  + * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/store/ContentStoreFilesystemImpl.java,v 1.5 2000/09/20 06:06:16 remm Exp $
  + * $Revision: 1.5 $
  + * $Date: 2000/09/20 06:06:16 $
    *
    * ====================================================================
    *
  @@ -75,7 +75,7 @@
    * Filesystem implementation of ContentStore.
    * 
    * @author <a href="mailto:remm@exoffice.com">Remy Maucherat</a>
  - * @version $Revision: 1.4 $
  + * @version $Revision: 1.5 $
    */
   public class ContentStoreFilesystemImpl extends ServiceImpl 
       implements ContentStore {
  @@ -308,7 +308,17 @@
               InputStream is = revisionContent.streamContent();
               
               if (is != null) {
  -                OutputStream os = new FileOutputStream(file);
  +                OutputStream os = null;
  +                try {
  +                    os = new FileOutputStream(file);
  +                } catch (FileNotFoundException ex) {
  +                    // Try to create the parent directory and try again
  +                    File parentFile = new File(file.getParent());
  +                    if ((parentFile != null) && (!parentFile.exists())) {
  +                        parentFile.mkdirs();
  +                    }
  +                    os = new FileOutputStream(file);
  +                }
                   // We copy 8 ko with each read
                   byte[] buffer = new byte[BUFFER_SIZE];
                   long position = 0;
  
  
  
  1.1                  jakarta-slide/src/share/org/apache/slide/util/MD5Encoder.java
  
  Index: MD5Encoder.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/util/MD5Encoder.java,v 1.1 2000/09/20 06:06:16 remm Exp $
   * $Revision: 1.1 $
   * $Date: 2000/09/20 06:06:16 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */ 
  
  
  package org.apache.slide.util;
  
  
  /**
   * Encode an MD5 digest into a String.
   * <p>
   * The 128 bit MD5 hash is converted into a 32 character long String.
   * Each character of the String is the hexadecimal representation of 4 bits
   * of the digest.
   *
   * @author Remy Maucherat
   * @version $Revision: 1.1 $ $Date: 2000/09/20 06:06:16 $
   */
  
  public final class MD5Encoder {
  
  
      // ----------------------------------------------------- Instance Variables
  
  
      private static final char[] hexadecimal = 
      {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 
       'a', 'b', 'c', 'd', 'e', 'f'};
  
  
      // --------------------------------------------------------- Public Methods
  
  
      /**
       * Encodes the 128 bit (16 bytes) MD5 into a 32 character String.
       *
       * @param binaryData Array containing the digest
       * @return Encoded MD5, or null if encoding failed
       */
      public String encode( byte[] binaryData ) {
          
          if (binaryData.length != 16)
              return null;
  
          char[] buffer = new char[32];
          
          for (int i=0; i<16; i++) {
              int low = (int) (binaryData[i] & 0x0f);
              int high = (int) ((binaryData[i] & 0xf0) >> 4);
              buffer[i*2] = hexadecimal[high];
              buffer[i*2 + 1] = hexadecimal[low];
          }
  
          return new String(buffer);
  
      }
  
  
  }
  
  
  
  
  1.6       +5 -3      jakarta-slide/src/share/org/apache/slide/webdav/WebdavServlet.java
  
  Index: WebdavServlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/WebdavServlet.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- WebdavServlet.java	2000/09/02 03:13:31	1.5
  +++ WebdavServlet.java	2000/09/20 06:06:17	1.6
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/WebdavServlet.java,v 1.5 2000/09/02 03:13:31 remm Exp $
  - * $Revision: 1.5 $
  - * $Date: 2000/09/02 03:13:31 $
  + * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/WebdavServlet.java,v 1.6 2000/09/20 06:06:17 remm Exp $
  + * $Revision: 1.6 $
  + * $Date: 2000/09/20 06:06:17 $
    *
    * ====================================================================
    *
  @@ -315,6 +315,8 @@
           } catch (Throwable t) {
   	    ;
   	}
  +        
  +        WebdavMethod.init();
           
           if (!Domain.isInitialized()) {
               
  
  
  
  1.3       +5 -5      jakarta-slide/src/share/org/apache/slide/webdav/common/WebdavXMLPrinter.java
  
  Index: WebdavXMLPrinter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/common/WebdavXMLPrinter.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- WebdavXMLPrinter.java	2000/07/23 21:57:52	1.2
  +++ WebdavXMLPrinter.java	2000/09/20 06:06:17	1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/common/WebdavXMLPrinter.java,v 1.2 2000/07/23 21:57:52 remm Exp $
  - * $Revision: 1.2 $
  - * $Date: 2000/07/23 21:57:52 $
  + * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/common/WebdavXMLPrinter.java,v 1.3 2000/09/20 06:06:17 remm Exp $
  + * $Revision: 1.3 $
  + * $Date: 2000/09/20 06:06:17 $
    *
    * ====================================================================
    *
  @@ -192,7 +192,7 @@
                   if (namespaceInfo != null) {
                       buffer.append("<" + namespace + ":" + name + " xmlns:" 
                                     + namespace + "=\"" 
  -                                  + namespaceInfo + ":\">");
  +                                  + namespaceInfo + "\">");
                   } else {
                       buffer.append("<" + namespace + ":" + name + ">");
                   }
  @@ -205,7 +205,7 @@
                   if (namespaceInfo != null) {
                       buffer.append("<" + namespace + ":" + name + " xmlns:" 
                                     + namespace + "=\"" 
  -                                  + namespaceInfo + ":\"/>");
  +                                  + namespaceInfo + "\"/>");
                   } else {
                       buffer.append("<" + namespace + ":" + name + "/>");
                   }
  
  
  
  1.10      +32 -34    jakarta-slide/src/share/org/apache/slide/webdav/method/LockMethod.java
  
  Index: LockMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/LockMethod.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- LockMethod.java	2000/09/19 04:21:08	1.9
  +++ LockMethod.java	2000/09/20 06:06:18	1.10
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/LockMethod.java,v 1.9 2000/09/19 04:21:08 remm Exp $
  - * $Revision: 1.9 $
  - * $Date: 2000/09/19 04:21:08 $
  + * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/LockMethod.java,v 1.10 2000/09/20 06:06:18 remm Exp $
  + * $Revision: 1.10 $
  + * $Date: 2000/09/20 06:06:18 $
    *
    * ====================================================================
    *
  @@ -481,9 +481,9 @@
                   lock.lock(credToken, lockToken);
                   
                   lockToken = new NodeLock
  -                    (toLockSubject, credentialsSubject, 
  -                     namespaceConfig.getCreateRevisionMetadataAction(), 
  -                     lockDate, inheritance, exclusive);
  +                    (lockToken, 
  +                     namespaceConfig.getCreateRevisionMetadataAction()
  +                     .getUri());
                   lock.lock(credToken, lockToken);
                   
                   lockToken = new NodeLock
  @@ -572,84 +572,82 @@
           // Generating XML response
           
           WebdavXMLPrinter generatedXML = new WebdavXMLPrinter();
  -                
  +        
           generatedXML.writeXMLHeader();
  -        generatedXML.writeElement("d", "DAV", "prop", 
  +        generatedXML.writeElement("d", "DAV:", "prop", 
                                     WebdavXMLPrinter.OPENING);
           
  -        generatedXML.writeElement("d", "DAV", "lockdiscovery", 
  +        generatedXML.writeElement("d", null, "lockdiscovery", 
                                     WebdavXMLPrinter.OPENING);
           
  -        generatedXML.writeElement("d", "DAV", "activelock", 
  +        generatedXML.writeElement("d", null, "activelock", 
                                     WebdavXMLPrinter.OPENING);
           
  -        generatedXML.writeElement("d", "DAV", "locktype", 
  +        generatedXML.writeElement("d", null, "locktype", 
                                     WebdavXMLPrinter.OPENING);
  -        generatedXML.writeElement("d", "DAV", "write", 
  +        generatedXML.writeElement("d", null, "write", 
                                     WebdavXMLPrinter.NO_CONTENT);
  -        generatedXML.writeElement("d", "DAV", "locktype", 
  +        generatedXML.writeElement("d", null, "locktype", 
                                     WebdavXMLPrinter.CLOSING);
           
  -        generatedXML.writeElement("d", "DAV", "lockscope", 
  +        generatedXML.writeElement("d", null, "lockscope", 
                                     WebdavXMLPrinter.OPENING);
  +        
           if (token.isExclusive()) {
  -            generatedXML.writeElement("d", "DAV", "exclusive", 
  +            generatedXML.writeElement("d", null, "exclusive", 
                                         WebdavXMLPrinter.NO_CONTENT);
           } else {
  -            generatedXML.writeElement("d", "DAV", "shared", 
  +            generatedXML.writeElement("d", null, "shared", 
                                         WebdavXMLPrinter.NO_CONTENT);
           }
  -        generatedXML.writeElement("d", "DAV", "lockscope", 
  +        generatedXML.writeElement("d", null, "lockscope", 
                                     WebdavXMLPrinter.CLOSING);
           
  -        generatedXML.writeElement("d", "DAV", "depth", 
  +        generatedXML.writeElement("d", null, "depth", 
                                     WebdavXMLPrinter.OPENING);
           if (token.isInheritable()) {
               generatedXML.writeText("Infinity");
           } else {
               generatedXML.writeText("0");
           }
  -        generatedXML.writeElement("d", "DAV", "depth", 
  +        generatedXML.writeElement("d", null, "depth", 
                                     WebdavXMLPrinter.CLOSING);
           
  -        generatedXML.writeElement("d", "DAV", "owner", 
  -                                  WebdavXMLPrinter.OPENING);
  -        generatedXML.writeElement("d", "DAV", "href", 
  +        generatedXML.writeElement("d", null, "owner", 
                                     WebdavXMLPrinter.OPENING);
  +        //generatedXML.writeText(lockInfo_lockOwner);
           generatedXML.writeText(req.getServletPath() + token.getSubjectUri());
  -        generatedXML.writeElement("d", "DAV", "href", 
  -                                  WebdavXMLPrinter.CLOSING);
  -        generatedXML.writeElement("d", "DAV", "owner", 
  +        generatedXML.writeElement("d", null, "owner", 
                                     WebdavXMLPrinter.CLOSING);
           
  -        generatedXML.writeElement("d", "DAV", "timeout", 
  +        generatedXML.writeElement("d", null, "timeout", 
                                     WebdavXMLPrinter.OPENING);
           generatedXML.writeText("Second-" 
                                  + (new Long((token.getExpirationDate().getTime()
                                               - (new Date()).getTime())/1000))
                                  .toString());
  -        generatedXML.writeElement("d", "DAV", "timeout", 
  +        generatedXML.writeElement("d", null, "timeout", 
                                     WebdavXMLPrinter.CLOSING);
           
  -        generatedXML.writeElement("d", "DAV", "locktoken", 
  +        generatedXML.writeElement("d", null, "locktoken", 
                                     WebdavXMLPrinter.OPENING);
  -        generatedXML.writeElement("d", "DAV", "href", 
  +        generatedXML.writeElement("d", null, "href", 
                                     WebdavXMLPrinter.OPENING);
           // Put here the token Id
           generatedXML.writeText("opaquelocktoken:" + token.getLockId());
           
  -        generatedXML.writeElement("d", "DAV", "href", 
  +        generatedXML.writeElement("d", null, "href", 
                                     WebdavXMLPrinter.CLOSING);
  -        generatedXML.writeElement("d", "DAV", "locktoken", 
  +        generatedXML.writeElement("d", null, "locktoken", 
                                     WebdavXMLPrinter.CLOSING);
           
  -        generatedXML.writeElement("d", "DAV", "activelock", 
  +        generatedXML.writeElement("d", null, "activelock", 
                                     WebdavXMLPrinter.CLOSING);
           
  -        generatedXML.writeElement("d", "DAV", "lockdiscovery", 
  +        generatedXML.writeElement("d", null, "lockdiscovery", 
                                     WebdavXMLPrinter.CLOSING);
           
  -        generatedXML.writeElement("d", "DAV", "prop", 
  +        generatedXML.writeElement("d", null, "prop", 
                                     WebdavXMLPrinter.CLOSING);
           
           try {
  
  
  
  1.6       +7 -3      jakarta-slide/src/share/org/apache/slide/webdav/method/PutMethod.java
  
  Index: PutMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/PutMethod.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- PutMethod.java	2000/09/05 05:38:10	1.5
  +++ PutMethod.java	2000/09/20 06:06:18	1.6
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/PutMethod.java,v 1.5 2000/09/05 05:38:10 remm Exp $
  - * $Revision: 1.5 $
  - * $Date: 2000/09/05 05:38:10 $
  + * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/PutMethod.java,v 1.6 2000/09/20 06:06:18 remm Exp $
  + * $Revision: 1.6 $
  + * $Date: 2000/09/20 06:06:18 $
    *
    * ====================================================================
    *
  @@ -177,6 +177,10 @@
                       + revisionNumber.hashCode() + "_"
                       + revisionDescriptor.getContentLength();
                   property = new NodeProperty("getetag", etag, true);
  +                revisionDescriptor.setProperty(property);
  +                
  +                // Resource type
  +                property = new NodeProperty("resourcetype", "", true);
                   revisionDescriptor.setProperty(property);
                   
                   content.create(credToken, resourcePath, revisionDescriptor, 
  
  
  
  1.7       +64 -4     jakarta-slide/src/share/org/apache/slide/webdav/method/WebdavMethod.java
  
  Index: WebdavMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/WebdavMethod.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- WebdavMethod.java	2000/09/19 04:21:09	1.6
  +++ WebdavMethod.java	2000/09/20 06:06:18	1.7
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/WebdavMethod.java,v 1.6 2000/09/19 04:21:09 remm Exp $
  - * $Revision: 1.6 $
  - * $Date: 2000/09/19 04:21:09 $
  + * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/WebdavMethod.java,v 1.7 2000/09/20 06:06:18 remm Exp $
  + * $Revision: 1.7 $
  + * $Date: 2000/09/20 06:06:18 $
    *
    * ====================================================================
    *
  @@ -64,6 +64,8 @@
   package org.apache.slide.webdav.method;
   
   import java.security.Principal;
  +import java.security.MessageDigest;
  +import java.security.NoSuchAlgorithmException;
   import java.io.*;
   import java.util.*;
   import javax.servlet.*;
  @@ -81,6 +83,7 @@
   import org.apache.slide.security.*;
   import org.apache.slide.webdav.common.*;
   import org.apache.slide.webdav.*;
  +import org.apache.slide.util.MD5Encoder;
   
   /**
    * WebDAV method.
  @@ -88,6 +91,12 @@
   public abstract class WebdavMethod {
       
       
  +    // -------------------------------------------------------------- Constants
  +    
  +    
  +    public static final String LOCK_TOKEN = "opaquelocktoken:";
  +    
  +    
       // ----------------------------------------------------- Instance Variables
       
       
  @@ -198,6 +207,18 @@
       protected String defaultNamespace = NodeProperty.DEFAULT_NAMESPACE;
       
       
  +    /**
  +     * MD5 message digest provider.
  +     */
  +    protected static MessageDigest md5Helper;
  +
  +
  +    /**
  +     * The MD5 helper object for this class.
  +     */
  +    protected static final MD5Encoder md5Encoder = new MD5Encoder();
  +
  +
       // ----------------------------------------------------------- Constructors
       
       
  @@ -250,6 +271,22 @@
       
       
       /**
  +     * Initializes static fields.
  +     */
  +    public static void init() {
  +        
  +        // Load the MD5 helper used to calculate signatures.
  +        try {
  +            md5Helper = MessageDigest.getInstance("MD5");
  +        } catch (NoSuchAlgorithmException e) {
  +            e.printStackTrace();
  +            throw new IllegalStateException();
  +        }
  +        
  +    }
  +    
  +    
  +    /**
        * Exceute method.
        * 
        * @exception WebdavException 
  @@ -369,9 +406,32 @@
           
           // Retrieve if header
           String ifHeader = req.getHeader("If");
  +        System.out.println("If header : " + ifHeader);
           
  -        // Parse if header and extract the lock tokens
  +        if (ifHeader == null)
  +            return;
           
  +        // Parse if header and extract the lock tokens
  +        int pos = ifHeader.indexOf(LOCK_TOKEN);
  +        int endPos = -1;
  +        int offset = LOCK_TOKEN.length();
  +        String lockToken = null;
  +        
  +        while (pos != -1) {
  +            
  +            endPos = ifHeader.indexOf('>', pos + offset);
  +            if (endPos == -1) {
  +                lockToken = ifHeader;
  +            } else {
  +                lockToken = ifHeader.substring(pos + offset, endPos);
  +            }
  +            
  +            System.out.println("Lock Token found :-" + lockToken + "-");
  +            credToken.addLockToken(lockToken);
  +            
  +            pos = ifHeader.indexOf(LOCK_TOKEN, endPos);
  +            
  +        }
           
       }