[prev in list] [next in list] [prev in thread] [next in thread] 

List:       slide-dev
Subject:    cvs commit: jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods CopyMethod.java MoveMe
From:       remm () apache ! org
Date:       2001-02-26 6:35:58
[Download RAW message or body]

remm        01/02/25 22:35:57

  Modified:    src/webdav/client/src/org/apache/webdav/lib State.java
                        WebdavClient.java
               src/webdav/client/src/org/apache/webdav/lib/methods
                        CopyMethod.java MoveMethod.java WebdavMethod.java
                        WebdavMethodBase.java XMLResponseMethodBase.java
  Log:
  - The charset related parameters are moved to the state token. They are no
    longer static.
  
  Revision  Changes    Path
  1.2       +73 -4     \
jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/State.java  
  Index: State.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/State.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- State.java	2000/11/22 06:19:08	1.1
  +++ State.java	2001/02/26 06:35:56	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/State.java,v \
                1.1 2000/11/22 06:19:08 remm Exp $
  - * $Revision: 1.1 $
  - * $Date: 2000/11/22 06:19:08 $
  + * $Header: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/State.java,v \
1.2 2001/02/26 06:35:56 remm Exp $  + * $Revision: 1.2 $
  + * $Date: 2001/02/26 06:35:56 $
    *
    * ====================================================================
    *
  @@ -64,8 +64,12 @@
   package org.apache.webdav.lib;
   
   import java.io.IOException;
  -import java.util.*;
  +import java.util.Hashtable;
  +import java.util.Vector;
  +import java.util.Enumeration;
  +import org.apache.util.URLUtil;
   
  +
   /**
    * Session state.
    * 
  @@ -95,6 +99,24 @@
       protected Vector cookies = new Vector();
       
       
  +    /**
  +     * URL encoding switch.
  +     */
  +    protected boolean encodeURLs = true;
  +
  +
  +    /**
  +     * URL encoding charset.
  +     */
  +    protected String URLEncodingCharset = "UTF8";
  +    
  +    
  +    /**
  +     * URL decoding charset.
  +     */
  +    protected String URLDecodingCharset = "UTF8";
  +
  +
       // ------------------------------------------------------------- Properties
       
       
  @@ -222,4 +244,51 @@
       }
       
       
  +    /**
  +     * Set the URL encoding flag.
  +     */
  +    public void setEncodeURLs(boolean encodeURLs) {
  +        this.encodeURLs = encodeURLs;
  +    }
  +
  +
  +    /**
  +     * Set URL encoding charset.
  +     */
  +    public void setURLEncodingCharset(String URLEncodingCharset) {
  +        this.URLEncodingCharset = URLEncodingCharset;
  +    }
  +
  +
  +    /**
  +     * Set URL decoding charset.
  +     */
  +    public void setURLDecodingCharset(String URLDecodingCharset) {
  +        this.URLDecodingCharset = URLDecodingCharset;
  +    }
  +
  +
  +    // --------------------------------------------------------- Public Methods
  +    
  +    
  +    /**
  +     * URL encode.
  +     */
  +    public String URLEncode(String url) {
  +        if (encodeURLs) {
  +            return URLUtil.URLEncode(url, URLEncodingCharset);
  +        } else {
  +            return url;
  +        }
  +    }
  +
  +
  +    /**
  +     * URL decode.
  +     */
  +    public String URLDecode(String url) {
  +        return URLUtil.URLDecode(url, URLDecodingCharset);
  +    }
  +
  +
   }
  
  
  
  1.25      +6 -66     \
jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/WebdavClient.java  
  Index: WebdavClient.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/WebdavClient.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- WebdavClient.java	2001/02/25 07:28:42	1.24
  +++ WebdavClient.java	2001/02/26 06:35:57	1.25
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/WebdavClient.java,v \
                1.24 2001/02/25 07:28:42 remm Exp $
  - * $Revision: 1.24 $
  - * $Date: 2001/02/25 07:28:42 $
  + * $Header: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/WebdavClient.java,v \
1.25 2001/02/26 06:35:57 remm Exp $  + * $Revision: 1.25 $
  + * $Date: 2001/02/26 06:35:57 $
    *
    * ====================================================================
    *
  @@ -74,7 +74,6 @@
   import java.net.UnknownHostException;
   import java.net.URL;
   import java.lang.reflect.Method;
  -import org.apache.util.URLUtil;
   import org.apache.webdav.lib.methods.WebdavMethod;
   
   /**
  @@ -185,24 +184,6 @@
       protected int debug = 0;
   
   
  -    /**
  -     * URL encoding switch.
  -     */
  -    protected static boolean encodeURLs = true;
  -
  -
  -    /**
  -     * URL encoding charset.
  -     */
  -    protected static String URLEncodingCharset = "UTF8";
  -
  -
  -    /**
  -     * URL decoding charset.
  -     */
  -    protected static String URLDecodingCharset = "UTF8";
  -
  -
       // ------------------------------------------------------------- Properties
   
   
  @@ -270,30 +251,6 @@
       }
   
   
  -    /**
  -     * Set the URL encoding flag.
  -     */
  -    public static void setEncodeURLs(boolean encodeURLs) {
  -        WebdavClient.encodeURLs = encodeURLs;
  -    }
  -
  -
  -    /**
  -     * Set URL encoding charset.
  -     */
  -    public static void setURLEncodingCharset(String URLEncodingCharset) {
  -        WebdavClient.URLEncodingCharset = URLEncodingCharset;
  -    }
  -
  -
  -    /**
  -     * Set URL decoding charset.
  -     */
  -    public static void setURLDecodingCharset(String URLDecodingCharset) {
  -        WebdavClient.URLDecodingCharset = URLDecodingCharset;
  -    }
  -
  -
       // --------------------------------------------------------- Public Methods
   
   
  @@ -499,26 +456,6 @@
       }
   
   
  -    /**
  -     * URL encode.
  -     */
  -    public static String URLEncode(String url) {
  -        if (encodeURLs) {
  -            return URLUtil.URLEncode(url, URLEncodingCharset);
  -        } else {
  -            return url;
  -        }
  -    }
  -
  -
  -    /**
  -     * URL decode.
  -     */
  -    public static String URLDecode(String url) {
  -        return URLUtil.URLDecode(url, URLDecodingCharset);
  -    }
  -
  -
       // ------------------------------------------------------ Protected Methods
   
   
  @@ -587,6 +524,8 @@
           if (!method.validate())
               throw new WebdavException("Invalid method");
   
  +        method.setState(state);
  +
           String requestLine = method.generateRequestLine();
   
           if (debug > 0)
  @@ -597,6 +536,7 @@
               hostName = hostName + ":" + sessionPort;
   
           method.generateHeaders(hostName, state);
  +
           Enumeration headersList = method.getHeaders();
   
           // Sending request line
  
  
  
  1.8       +5 -5      \
jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/CopyMethod.java  
  Index: CopyMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/CopyMethod.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- CopyMethod.java	2001/02/25 07:28:42	1.7
  +++ CopyMethod.java	2001/02/26 06:35:57	1.8
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/CopyMethod.java,v \
                1.7 2001/02/25 07:28:42 remm Exp $
  - * $Revision: 1.7 $
  - * $Date: 2001/02/25 07:28:42 $
  + * $Header: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/CopyMethod.java,v \
1.8 2001/02/26 06:35:57 remm Exp $  + * $Revision: 1.8 $
  + * $Date: 2001/02/26 06:35:57 $
    *
    * ====================================================================
    *
  @@ -65,8 +65,8 @@
   
   import org.apache.webdav.lib.State;
   import org.apache.webdav.lib.Header;
  -import org.apache.webdav.lib.WebdavClient;
   
  +
   /**
    * COPY Method.
    *
  @@ -199,7 +199,7 @@
           super.generateHeaders(host, state);
   
           String absoluteDestination = "http://" + host 
  -            + WebdavClient.URLEncode(destination);
  +            + state.URLEncode(destination);
   
           setHeader("Destination", absoluteDestination);
           if (!isOverwrite())
  
  
  
  1.8       +5 -5      \
jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/MoveMethod.java  
  Index: MoveMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/MoveMethod.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- MoveMethod.java	2001/02/25 07:28:42	1.7
  +++ MoveMethod.java	2001/02/26 06:35:57	1.8
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/MoveMethod.java,v \
                1.7 2001/02/25 07:28:42 remm Exp $
  - * $Revision: 1.7 $
  - * $Date: 2001/02/25 07:28:42 $
  + * $Header: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/MoveMethod.java,v \
1.8 2001/02/26 06:35:57 remm Exp $  + * $Revision: 1.8 $
  + * $Date: 2001/02/26 06:35:57 $
    *
    * ====================================================================
    *
  @@ -65,8 +65,8 @@
   
   import org.apache.webdav.lib.State;
   import org.apache.webdav.lib.Header;
  -import org.apache.webdav.lib.WebdavClient;
   
  +
   /**
    * MOVE Method.
    *
  @@ -198,7 +198,7 @@
           super.generateHeaders(host, state);
   
           String absoluteDestination = "http://" + host 
  -            + WebdavClient.URLEncode(destination);
  +            + state.URLEncode(destination);
   
           setHeader("Destination", absoluteDestination);
           if (!isOverwrite())
  
  
  
  1.8       +9 -3      \
jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/WebdavMethod.java  
  Index: WebdavMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/WebdavMethod.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- WebdavMethod.java	2001/02/25 07:28:42	1.7
  +++ WebdavMethod.java	2001/02/26 06:35:57	1.8
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/WebdavMethod.java,v \
                1.7 2001/02/25 07:28:42 remm Exp $
  - * $Revision: 1.7 $
  - * $Date: 2001/02/25 07:28:42 $
  + * $Header: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/WebdavMethod.java,v \
1.8 2001/02/26 06:35:57 remm Exp $  + * $Revision: 1.8 $
  + * $Date: 2001/02/26 06:35:57 $
    *
    * ====================================================================
    *
  @@ -203,6 +203,12 @@
        * @return boolean True if auto redirect should be used for this method
        */
       public boolean followRedirects();
  +
  +
  +    /**
  +     * Set the state token.
  +     */
  +    public void setState(State state);
   
   
       // ------------------------------------------------------ Interface Methods
  
  
  
  1.14      +12 -7     \
jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/WebdavMethodBase.java
  
  Index: WebdavMethodBase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/WebdavMethodBase.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- WebdavMethodBase.java	2001/02/25 07:28:42	1.13
  +++ WebdavMethodBase.java	2001/02/26 06:35:57	1.14
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/WebdavMethodBase.java,v \
                1.13 2001/02/25 07:28:42 remm Exp $
  - * $Revision: 1.13 $
  - * $Date: 2001/02/25 07:28:42 $
  + * $Header: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/WebdavMethodBase.java,v \
1.14 2001/02/26 06:35:57 remm Exp $  + * $Revision: 1.14 $
  + * $Date: 2001/02/26 06:35:57 $
    *
    * ====================================================================
    *
  @@ -304,6 +304,14 @@
       }
   
   
  +    /**
  +     * Set the state token.
  +     */
  +    public void setState(State state) {
  +        this.state = state;
  +    }
  +
  +
       // --------------------------------------------------- WebdavMethod Methods
   
   
  @@ -376,9 +384,6 @@
   
           headers.clear();
   
  -        // Default implementation adds the lock token headers if necessary
  -        this.state = state;
  -
           // good practice to provide a user-agent indicator
           if (!headers.containsKey("user-agent")) {
               headers.put("user-agent", WebdavClient.USER_AGENT);
  @@ -484,7 +489,7 @@
        */
       public final String generateRequestLine() {
   
  -        return (getName() + " " + WebdavClient.URLEncode(path) + " " 
  +        return (getName() + " " + state.URLEncode(path) + " " 
                   + PROTOCOL + "\r\n");
   
       }
  
  
  
  1.9       +1 -2      \
jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/XMLResponseMethodBase.java
  
  Index: XMLResponseMethodBase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/XMLResponseMethodBase.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- XMLResponseMethodBase.java	2001/02/25 07:28:42	1.8
  +++ XMLResponseMethodBase.java	2001/02/26 06:35:57	1.9
  @@ -81,7 +81,6 @@
   import org.apache.webdav.lib.Property;
   import org.apache.webdav.lib.WebdavException;
   import org.apache.webdav.lib.WebdavStatus;
  -import org.apache.webdav.lib.WebdavClient;
   
   import org.apache.webdav.lib.properties.GetLastModifiedProperty;
   import org.apache.webdav.lib.properties.ResourceTypeProperty;
  @@ -366,7 +365,7 @@
           public String getHref() {
               Element href = getFirstElement("DAV:", "href");
               if (href != null) {
  -                return WebdavClient.URLDecode(DOMUtils.getTextValue(href));
  +                return state.URLDecode(DOMUtils.getTextValue(href));
               } else {
                   return "";
               }
  
  
  


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic