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 lu...@apache.org on 2004/08/20 12:53:23 UTC

cvs commit: jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/taskdefs Copy.java Delete.java Get.java Move.java Proppatch.java Put.java WebdavTask.java

luetzkendorf    2004/08/20 03:53:23

  Modified:    webdavclient/ant/src/java/org/apache/webdav/ant
                        CollectionScanner.java ResourceProperties.java
                        Utils.java WebdavFileSet.java
               webdavclient/ant/src/java/org/apache/webdav/ant/doc-files
                        tasks.htm
               webdavclient/ant/src/java/org/apache/webdav/ant/taskdefs
                        Copy.java Delete.java Get.java Move.java
                        Proppatch.java Put.java WebdavTask.java
  Log:
  merge with SLIDE_2_1_RELEASE_BRANCH
  
  Revision  Changes    Path
  1.4       +7 -7      jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/CollectionScanner.java
  
  Index: CollectionScanner.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/CollectionScanner.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CollectionScanner.java	28 Jul 2004 09:31:49 -0000	1.3
  +++ CollectionScanner.java	20 Aug 2004 10:53:21 -0000	1.4
  @@ -97,7 +97,7 @@
            throws URIException
      {
         if (!collURL.getPath().endsWith(SEPARATOR)) {
  -         collURL = new HttpURL(collURL, "");
  +         collURL = Utils.createHttpURL(collURL, "");
            collURL.setPath(collURL.getPath() + SEPARATOR);
         }
         
  @@ -132,9 +132,9 @@
                  if (!href.endsWith(SEPARATOR)) href = href + SEPARATOR;
                  // the collection URL itself may be in the list of 
                  // response URL; filter them out to avoid recursion 
  -               HttpURL sub = new HttpURL(collURL, href);
  +               HttpURL sub = Utils.createHttpURL(collURL, href);
                  if (!sub.equals(collURL)) {
  -                  subCollections.add(new HttpURL(collURL, href));
  +                  subCollections.add(Utils.createHttpURL(collURL, href));
                  }
               } else {
                  addResource(href, false);
  @@ -154,7 +154,7 @@
               throws ScanException 
      {
         try {
  -         String path = (new HttpURL(getBaseURL(), href)).getPath();
  +         String path = (Utils.createHttpURL(getBaseURL(), href)).getPath();
            String relPath = path.substring(getBaseURL().getPath().length());
            if (relPath.startsWith(SEPARATOR)) {
               relPath = relPath.substring(1);
  
  
  
  1.4       +5 -5      jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/ResourceProperties.java
  
  Index: ResourceProperties.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/ResourceProperties.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ResourceProperties.java	28 Jul 2004 09:31:49 -0000	1.3
  +++ ResourceProperties.java	20 Aug 2004 10:53:21 -0000	1.4
  @@ -76,7 +76,7 @@
                                  PropertyName propertyName)
         throws URIException
      {
  -      HttpURL url = new HttpURL(baseUrl, relative);
  +      HttpURL url = Utils.createHttpURL(baseUrl, relative);
         return getProperty(url.getURI(), propertyName);
      }
      
  @@ -109,7 +109,7 @@
      public ResourceTypeProperty getResourceType(HttpURL baseUrl, String relative)
         throws URIException
      {
  -      HttpURL url = new HttpURL(baseUrl, relative);
  +      HttpURL url = Utils.createHttpURL(baseUrl, relative);
         return getResourceType(url.toString());
      }
      
  
  
  
  1.8       +34 -6     jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/Utils.java
  
  Index: Utils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/Utils.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Utils.java	2 Aug 2004 15:45:51 -0000	1.7
  +++ Utils.java	20 Aug 2004 10:53:21 -0000	1.8
  @@ -38,6 +38,8 @@
   import org.apache.commons.httpclient.HttpMethod;
   import org.apache.commons.httpclient.HttpStatus;
   import org.apache.commons.httpclient.HttpURL;
  +import org.apache.commons.httpclient.HttpsURL;
  +import org.apache.commons.httpclient.URIException;
   import org.apache.commons.httpclient.methods.GetMethod;
   import org.apache.commons.httpclient.methods.HeadMethod;
   import org.apache.commons.httpclient.methods.PutMethod;
  @@ -222,7 +224,7 @@
         Stack toBeCreated = new Stack();
         
         while (!path.equals("/")) {
  -         HttpURL parent = new HttpURL(httpURL, path);
  +         HttpURL parent = Utils.createHttpURL(httpURL, path);
            if (!collectionExists(client, parent)) {
               toBeCreated.push(path);
               path = path.substring(0, path.lastIndexOf("/", path.length()-2)+1);
  @@ -233,7 +235,7 @@
   
         boolean created = !toBeCreated.empty(); 
         while(!toBeCreated.empty()) {
  -         HttpURL newColl = new HttpURL(httpURL, (String)toBeCreated.pop());
  +         HttpURL newColl = Utils.createHttpURL(httpURL, (String)toBeCreated.pop());
            MkcolMethod mkcol = new MkcolMethod(newColl.getURI());
            generateIfHeader(mkcol, lockToken);
            int status = client.executeMethod(mkcol);
  @@ -353,7 +355,11 @@
                                      String destination, int depth, boolean overwrite)
         throws IOException, HttpException 
      {
  -      CopyMethod copy = new CopyMethod(url.getURI(), destination, overwrite, depth);
  +      CopyMethod copy = new CopyMethod(
  +              url.getURI(), 
  +              destination, 
  +              overwrite, 
  +              depth);
         int status = client.executeMethod(copy);
         switch (status) {
            case WebdavStatus.SC_OK:
  @@ -435,4 +441,26 @@
         
         return new BuildException(b.toString());
      }
  +   
  +   
  +   public static HttpURL createHttpURL(HttpURL base, String relative) 
  +       throws URIException
  +   {
  +     if (base instanceof HttpsURL) {
  +        return new HttpsURL((HttpsURL)base, relative);
  +     } else {
  +        return new HttpURL(base, relative);
  +     }
  +   }
  +    
  +   public static HttpURL createHttpURL(String url) throws URIException
  +   {
  +      if (url.startsWith("https://")) {
  +         return new HttpsURL(url);
  +      } else {
  +         return new HttpURL(url);
  +      }
  +   }
  +
  +
   }
  
  
  
  1.4       +4 -4      jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/WebdavFileSet.java
  
  Index: WebdavFileSet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/WebdavFileSet.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- WebdavFileSet.java	28 Jul 2004 09:31:49 -0000	1.3
  +++ WebdavFileSet.java	20 Aug 2004 10:53:22 -0000	1.4
  @@ -59,7 +59,7 @@
         CollectionScanner scanner = new CollectionScanner();
         
         try {
  -         scanner.setBaseURL(new HttpURL(baseUrl, directory));
  +         scanner.setBaseURL(Utils.createHttpURL(baseUrl, directory));
         } catch (URIException e) {
            throw new BuildException("Invalid URL. " + e.toString(), e);
         }
  
  
  
  1.2       +81 -11    jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/doc-files/tasks.htm
  
  Index: tasks.htm
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/doc-files/tasks.htm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- tasks.htm	24 May 2004 09:20:26 -0000	1.1
  +++ tasks.htm	20 Aug 2004 10:53:22 -0000	1.2
  @@ -1,6 +1,11 @@
   <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
   <HTML><HEAD> 
  -	 <TITLE>WebDAV ant tasks</TITLE></HEAD> 
  +	 <TITLE>WebDAV ant tasks</TITLE> <STYLE TYPE="text/css">
  +	 	BODY {
  +			font-family: Arial, sans-serif;
  +		}
  +	 </STYLE> 
  +  </HEAD> 
     <BODY> 
   	 <H1>WebDAV ant tasks</H1> 
   	 <P>Tasks for Jakarta Ant for dealing with WebDAV repositories. </P> 
  @@ -11,9 +16,9 @@
   		<LI>Jakarta Slide WebDAV Client library</LI> 
   		<LI>Jakarta Commons Logging library</LI> 
   	 </UL> 
  -	 <H3>Task definitions</H3>
  +	 <H3>Task definitions</H3> 
   	 <P>Copy the four java libraries to your <TT>${ANT_HOME}/lib</TT> directory.
  -		And choose on of the following options to declare the WebDAV tasks.</P>
  +		And choose on of the following options to declare the WebDAV tasks.</P> 
   	 <P>Way 1: Declare the tasks in like the following. Daclare any name and use
   		the name for the tasks described below.</P> 
   	 <PRE> &lt;target name="declare-tasks"&gt;
  @@ -24,15 +29,17 @@
      &lt;taskdef name="mkcol"  classname="org.apache.webdav.ant.taskdefs.Mkcol"/&gt;
      &lt;taskdef name="davdelete" classname="org.apache.webdav.ant.taskdefs.Delete"/&gt;
      &lt;taskdef name="proppatch" classname="org.apache.webdav.ant.taskdefs.Proppatch"/&gt;
  - &lt;/target&gt;</PRE>
  -	 <P>Way 1a.</P>
  +   &lt;taskdef name="davcopy" classname="org.apache.webdav.ant.taskdefs.Copy"/&gt;
  +   &lt;taskdef name="davmove" classname="org.apache.webdav.ant.taskdefs.Move"/&gt;
  + &lt;/target&gt;</PRE> 
  +	 <P>Way 1a.</P> 
   	 <PRE>  &lt;target name="declare-tasks"&gt;
       &lt;taskdef resource="org/apache/webdav/ant/taskdefs.properties"/&gt;
     &lt;/target&gt;</PRE> 
   	 <P>Way 2: Declare the namespace <TT>antlib:org.apache.webdav.ant</TT>, e.g.
  -		at the <TT>project</TT> element of your <TT>build.xml</TT>. </P>
  +		at the <TT>project</TT> element of your <TT>build.xml</TT>. </P> 
   	 <PRE>  &lt;project name="site-update" 
  -					      default="upload" 
  +           default="upload" 
              xmlns:dav="antlib:org.apache.webdav.ant"&gt;
       &lt;target name="uplaod"
         &lt;dav:put url="http://${DAV.server}/${DAV.root}"
  @@ -43,10 +50,10 @@
           &lt;/dav:fileset&gt;
         &lt;/dav:put&gt;
       &lt;/target&gt;
  -  &lt;/project&gt;</PRE>
  +  &lt;/project&gt;</PRE> 
   	 <P>As you can see you use the prefix declared for the namespace
   		<TT>antlib:org.apache.webdav.ant</TT> for all WebDAV ant tasks and for all its
  -		children. (The later I didn't understand, but without it doesn't work.)</P>
  +		children. (The later I didn't understand, but without it doesn't work.)</P> 
   	 <H2>common attributes</H2> 
   	 <P>All of the ant tasks described below have the following attributes.</P> 
   	 <TABLE BORDER="1" CELLPADDING="2" CELLSPACING="0"> 
  @@ -115,12 +122,12 @@
   	 <PRE>  &lt;davget url="http://any.host.com/DAV"
             userid="${DAV.user}" password="${DAV.password}"
             todir="tmp"&gt;
  -    &lt;davfileset dir="any/colection"&gt;
  +    &lt;davfileset dir="any/collection"&gt;
         &lt;include name="**/*.xml"/&gt;
       &lt;/davfileset&gt;
     &lt;/davget&gt;</PRE> 
   	 <P>Retrieves all XML files from the DAV collection published under
  -		<TT>http://any.host.com/DAV/any/colection</TT>and its sub collections.</P> 
  +		<TT>http://any.host.com/DAV/any/collection</TT>and its sub collections.</P> 
   	 <PRE>  &lt;davget url="http://${DAV.server}/${DAV.root}/path/to/any/file.txt"
             userid="${DAV.user}" password="${DAV.password}"
             tofile="tmp/filterTest.txt" encoding="UTF-8"
  @@ -219,6 +226,69 @@
            userid="${DAV.user}" password="${DAV.password}"/&gt;</PRE> 
   	 <P>Creates a collection named <TT>/xx/yy/zz</TT>. If the collections
   		<TT>/xx</TT> and <TT>/xx/yy</TT> do not exist they are created too.</P> 
  +	 <H2><A NAME="davcopy">davcopy, dav:copy</A></H2> 
  +	 <H4>Description</H4> 
  +	 <P>Copies/renames a resource on a single WebDAV-Server.</P> 
  +	 <TABLE BORDER="1" CELLPADDING="2" CELLSPACING="0"> 
  +		<TR> 
  +		  <TD VALIGN="top"><B>Attribute</B></TD> 
  +		  <TD VALIGN="top"><B>Description</B></TD> 
  +		  <TD ALIGN="center" VALIGN="top"><B>Required</B></TD> 
  +		</TR> 
  +		<TR><TD VALIGN="top">destination</TD><TD VALIGN="top">URL to which the
  +			 source (given by the common <TT>url</TT> attribute) is to be copied.<BR>This
  +			 URL may be relative to <TT>url</TT> or an absolute one.</TD><TD VALIGN="middle"
  +		  ALIGN="center">Yes.</TD> 
  +		</TR> 
  +		<TR><TD VALIGN="top">overwrite</TD><TD VALIGN="top">Determines whether
  +			 the destination is overwritten if it always exists.</TD><TD VALIGN="middle"
  +		  ALIGN="center">No. Defaults to <TT>false</TT>.</TD> 
  +		</TR> 
  +		<TR><TD VALIGN="top">depth</TD><TD VALIGN="top">Determines whether the
  +			 copy of collections is shallow (<TT>0</TT>)or deep (<TT>infinity</TT>).</TD><TD
  +		  VALIGN="middle" ALIGN="center">No. Defaults to <TT>infinity</TT>.</TD> 
  +		</TR> 
  +	 </TABLE> 
  +	 <H4>Examples</H4> 
  +	 <PRE>   &lt;davcopy url="http://${DAV.server}/DAV/resource1" verbose="true"
  +            userid="${DAV.user}" password="${DAV.password}"
  +            destination="http://${DAV.server}/DAV/copy_of_resource1"/&gt;</PRE> 
  +	 <P>Copies <TT>resource</TT> to <TT>copy_of_resource</TT>. If
  +		<TT>resource</TT> is a collection the whole content is copied too.</P> 
  +	 <PRE>   &lt;davcopy url="http://${DAV.server}/DAV/resource1" verbose="true"
  +            userid="${DAV.user}" password="${DAV.password}"
  +            destination="copy_of_resource1"/&gt;</PRE> 
  +	 <P>Does the same as the first example, but the destination is given
  +		relative.</P> 
  +	 <H2><A NAME="davmove">davmove, dav:move</A></H2> 
  +	 <H4>Description</H4> 
  +	 <P>Moves/renames a WebDAV-resource.</P> 
  +	 <TABLE BORDER="1" CELLPADDING="2" CELLSPACING="0"> 
  +		<TR> 
  +		  <TD VALIGN="top"><B>Attribute</B></TD> 
  +		  <TD VALIGN="top"><B>Description</B></TD> 
  +		  <TD ALIGN="center" VALIGN="top"><B>Required</B></TD> 
  +		</TR> 
  +		<TR><TD VALIGN="top">destination</TD><TD VALIGN="top">URL to which the
  +			 source (given by the common <TT>url</TT> attribute) is to be moved.<BR>This URL
  +			 may be relative to <TT>url</TT> or an absolute one.</TD><TD VALIGN="middle"
  +		  ALIGN="center">Yes.</TD> 
  +		</TR> 
  +		<TR><TD VALIGN="top">overwrite</TD><TD VALIGN="top">Determines whether
  +			 the destination is overwritten if it always exists.</TD><TD VALIGN="middle"
  +		  ALIGN="center">No. Defaults to <TT>false</TT>.</TD> 
  +		</TR> 
  +	 </TABLE> 
  +	 <H4>Examples</H4> 
  +	 <PRE>   &lt;davmove url="http://${DAV.server}/DAV/resource1" verbose="true"
  +            userid="${DAV.user}" password="${DAV.password}"
  +            destination="http://${DAV.server}/DAV/resource2"/&gt;</PRE> 
  +	 <P>Renames the resource <TT>resource1</TT> to <TT>resource2</TT>.</P> 
  +	 <PRE>   &lt;davmove url="http://${DAV.server}/DAV/coll1/resource" verbose="true"
  +            userid="${DAV.user}" password="${DAV.password}"
  +            destination="/DAV/coll2/resource"/&gt;</PRE> 
  +	 <P>Moves the resource <TT>resource</TT> from collection <TT>coll1</TT> to
  +		<TT>coll2</TT> using a relative destination URL.</P> 
   	 <H2><A NAME="davdelete">davdelete, dav:delete</A></H2> 
   	 <H4>Description</H4> 
   	 <P>Deletes a WebDAV resource or a set of resources.</P> 
  
  
  
  1.3       +19 -6     jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/taskdefs/Copy.java
  
  Index: Copy.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/taskdefs/Copy.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Copy.java	28 Jul 2004 09:31:47 -0000	1.2
  +++ Copy.java	20 Aug 2004 10:53:22 -0000	1.3
  @@ -22,6 +22,9 @@
   
   import java.io.IOException;
   
  +import org.apache.commons.httpclient.HttpURL;
  +import org.apache.commons.httpclient.URIException;
  +
   import org.apache.tools.ant.BuildException;
   import org.apache.webdav.ant.Utils;
   import org.apache.webdav.lib.methods.DepthSupport;
  @@ -34,8 +37,9 @@
   public class Copy extends WebdavMatchingTask {
   
       private String destination;
  -    private int depth;
  -    private boolean overwrite;
  +    private int depth = DepthSupport.DEPTH_INFINITY;
  +    private boolean overwrite = false;
  +    private HttpURL destinationURL;
   
       /* 
        * @see org.apache.tools.ant.Task#execute()
  @@ -43,11 +47,12 @@
       public void execute() throws BuildException {
           validate();
           try {
  +            // TODO assure that the colletion to which we copy does exist
               log("Copying " + getUrl(), ifVerbose());
               Utils.copyResource(
                   getHttpClient(), 
                   getUrl(),
  -                this.destination,
  +                this.destinationURL.getURI(),
                   this.depth,
                   this.overwrite
               );
  @@ -82,6 +87,14 @@
           super.validate();
           if (destination == null) {
               throw new BuildException("Missing required attribute destination");
  +        }
  +        
  +        try {
  +            this.destinationURL = Utils.createHttpURL(getUrl(), this.destination);
  +            this.destinationURL.setPath(removeDoubleSlashes(
  +                    this.destinationURL.getPath()));
  +        } catch (URIException e) {
  +            throw new BuildException("Invalid destination uri!", e);
           }
       }
   
  
  
  
  1.6       +5 -5      jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/taskdefs/Delete.java
  
  Index: Delete.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/taskdefs/Delete.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Delete.java	2 Aug 2004 15:45:50 -0000	1.5
  +++ Delete.java	20 Aug 2004 10:53:22 -0000	1.6
  @@ -109,12 +109,12 @@
        
         String[] files = scanner.getIncludedFiles();
         for (int i = 0; i < files.length; i++) {
  -         HttpURL url = new HttpURL(baseUrl, files[i]);
  +         HttpURL url = Utils.createHttpURL(baseUrl, files[i]);
            delete(url, files[i]);
         }
         String[] colls = scanner.getIncludedDirectories();
         for (int i = 0; i < colls.length; i++) {
  -         HttpURL url = new HttpURL(baseUrl, colls[i]);
  +         HttpURL url = Utils.createHttpURL(baseUrl, colls[i]);
            delete(url, colls[i]);
         }
      }
  
  
  
  1.4       +4 -4      jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/taskdefs/Get.java
  
  Index: Get.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/taskdefs/Get.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Get.java	28 Jul 2004 09:31:47 -0000	1.3
  +++ Get.java	20 Aug 2004 10:53:22 -0000	1.4
  @@ -120,7 +120,7 @@
         
         String[] files = scanner.getIncludedFiles();
         for (int i = 0; i < files.length; i++) {
  -         HttpURL url = new HttpURL(baseUrl, files[i]);
  +         HttpURL url = Utils.createHttpURL(baseUrl, files[i]);
            downloadFile(url, files[i], scanner);
         }
      }
  
  
  
  1.4       +16 -4     jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/taskdefs/Move.java
  
  Index: Move.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/taskdefs/Move.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Move.java	28 Jul 2004 09:31:47 -0000	1.3
  +++ Move.java	20 Aug 2004 10:53:22 -0000	1.4
  @@ -22,6 +22,9 @@
   
   import java.io.IOException;
   
  +import org.apache.commons.httpclient.HttpURL;
  +import org.apache.commons.httpclient.URIException;
  +
   import org.apache.tools.ant.BuildException;
   import org.apache.webdav.ant.Utils;
   
  @@ -34,6 +37,7 @@
   
       private String destination;
       private boolean overwrite;
  +    private HttpURL destinationURL;
   
       /* 
        * @see org.apache.tools.ant.Task#execute()
  @@ -45,7 +49,7 @@
               Utils.moveResource(
                   getHttpClient(), 
                   getUrl(),
  -                this.destination,
  +                this.destinationURL.getURI(),
                   this.overwrite
               );
           }
  @@ -66,6 +70,14 @@
           super.validate();
           if (destination == null) {
               throw new BuildException("Missing required attribute destination");
  +        }
  +        
  +        try {
  +            this.destinationURL = Utils.createHttpURL(getUrl(), this.destination);
  +            this.destinationURL.setPath(removeDoubleSlashes(
  +                    this.destinationURL.getPath()));
  +        } catch (URIException e) {
  +            throw new BuildException("Invalid destination uri!", e);
           }
       }
   
  
  
  
  1.5       +5 -5      jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/taskdefs/Proppatch.java
  
  Index: Proppatch.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/taskdefs/Proppatch.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Proppatch.java	2 Aug 2004 15:45:50 -0000	1.4
  +++ Proppatch.java	20 Aug 2004 10:53:22 -0000	1.5
  @@ -153,12 +153,12 @@
        
         String[] files = scanner.getIncludedFiles();
         for (int i = 0; i < files.length; i++) {
  -         HttpURL url = new HttpURL(baseUrl, files[i]);
  +         HttpURL url = Utils.createHttpURL(baseUrl, files[i]);
            proppatch(url, files[i]);
         }
         String[] colls = scanner.getIncludedDirectories();
         for (int i = 0; i < colls.length; i++) {
  -         HttpURL url = new HttpURL(baseUrl, colls[i]);
  +         HttpURL url = Utils.createHttpURL(baseUrl, colls[i]);
            proppatch(url, colls[i]);
         }
      }
  
  
  
  1.4       +9 -9      jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/taskdefs/Put.java
  
  Index: Put.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/taskdefs/Put.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Put.java	28 Jul 2004 09:31:47 -0000	1.3
  +++ Put.java	20 Aug 2004 10:53:22 -0000	1.4
  @@ -162,7 +162,7 @@
                     Utils.assureExistingCollection(getHttpClient(), getUrl(), this.locktoken);
                     uploadFile(this.file.getName(), this.file);
                  } else {
  -                  HttpURL targetColl = new HttpURL(getUrl(), ".");
  +                  HttpURL targetColl = Utils.createHttpURL(getUrl(), ".");
                     Utils.assureExistingCollection(getHttpClient(), targetColl, this.locktoken);
                     uploadFile(getUrl(), this.file, this.file.getName());
                  }
  @@ -245,7 +245,7 @@
                                              getUrl(),
                                              this.locktoken);
            } else {
  -            HttpURL collURL = new HttpURL(getUrl(), dir + "/");
  +            HttpURL collURL = Utils.createHttpURL(getUrl(), dir + "/");
               Utils.assureExistingCollection(getHttpClient(), 
                                              collURL,
                                              this.locktoken);
  @@ -291,7 +291,7 @@
      private void uploadFile(String relative, File file)
         throws IOException
      {
  -      HttpURL url = new HttpURL(getUrl(), relative);
  +      HttpURL url = Utils.createHttpURL(getUrl(), relative);
         uploadFile(url, file, relative);
      }
      /**
  @@ -372,7 +372,7 @@
                                              getUrl(),
                                              this.locktoken);
            } else {
  -            HttpURL collURL = new HttpURL(getUrl(), dir + "/");
  +            HttpURL collURL = Utils.createHttpURL(getUrl(), dir + "/");
               Utils.assureExistingCollection(getHttpClient(), 
                                              collURL,
                                              this.locktoken);
  @@ -382,7 +382,7 @@
         // write all files
         String[] files = scanner.getIncludedFiles();
         for (int i = 0; i < files.length; ++i) {
  -         uploadZipEntry(new HttpURL(getUrl(), files[i]), files[i], zipFile);
  +         uploadZipEntry(Utils.createHttpURL(getUrl(), files[i]), files[i], zipFile);
         }
      }
      
  
  
  
  1.5       +10 -8     jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/taskdefs/WebdavTask.java
  
  Index: WebdavTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/webdavclient/ant/src/java/org/apache/webdav/ant/taskdefs/WebdavTask.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- WebdavTask.java	8 Aug 2004 13:28:07 -0000	1.4
  +++ WebdavTask.java	20 Aug 2004 10:53:22 -0000	1.5
  @@ -29,6 +29,7 @@
   import org.apache.tools.ant.BuildException;
   import org.apache.tools.ant.Project;
   import org.apache.tools.ant.Task;
  +import org.apache.webdav.ant.Utils;
   
   /**
    * Base class of all WebDAV tasks. Provides common attributes and the creation
  @@ -93,13 +94,14 @@
       */
      public void setUrl(String url) {
          try {
  -          this.url = new HttpURL(url);
  +          this.url = Utils.createHttpURL(url);
             // remove double slashes in url like /DAV/files//document.txt
  -          this.url.setPath(removeDoubleShashes(this.url.getPath()));
  +          this.url.setPath(removeDoubleSlashes(this.url.getPath()));
          } catch (URIException e) {
             throw new BuildException("Invalid uri!", e);
          }
      }
  +
      protected void setUrl(HttpURL url) {
         this.url = url;
      }
  @@ -119,19 +121,19 @@
         return this.verbose ? Project.MSG_INFO : Project.MSG_VERBOSE; 
      }
      
  -   protected HttpURL assureCollectionUrl(HttpURL url)
  +   public static HttpURL assureCollectionUrl(HttpURL url)
         throws URIException
      {
         if (url.getPath().endsWith("/")) {
            return url;
         } else {
  -         HttpURL coll = new HttpURL(url, "");
  +         HttpURL coll = Utils.createHttpURL(url, "");
            coll.setPath(url.getPath() + "/");
            return coll;
         }
      }
      
  -   static String removeDoubleShashes(String path) {
  +   static String removeDoubleSlashes(String path) {
         if (path.indexOf("//") == -1) return path;
         
         StringBuffer r = new StringBuffer(path.length());
  
  
  

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