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 2002/08/14 17:22:25 UTC

cvs commit: jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods CheckinMethod.java CheckoutMethod.java DeleteMethod.java LabelMethod.java LockMethod.java MkWorkspaceMethod.java OptionsMethod.java PropPatchMethod.java SearchMethod.java UncheckoutMethod.java UpdateMethod.java VersionControlMethod.java XMLResponseMethodBase.java

juergen     2002/08/14 08:22:25

  Modified:    src/webdav/client/src/org/apache/webdav/lib/methods
                        CheckinMethod.java CheckoutMethod.java
                        DeleteMethod.java LabelMethod.java LockMethod.java
                        MkWorkspaceMethod.java OptionsMethod.java
                        PropPatchMethod.java SearchMethod.java
                        UncheckoutMethod.java UpdateMethod.java
                        VersionControlMethod.java
                        XMLResponseMethodBase.java
  Log:
  refactor of parseResponse. The decision is now in the methods itself, not in the super class.
  
  Revision  Changes    Path
  1.7       +22 -3     jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/CheckinMethod.java
  
  Index: CheckinMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/CheckinMethod.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- CheckinMethod.java	1 Aug 2002 10:48:38 -0000	1.6
  +++ CheckinMethod.java	14 Aug 2002 15:22:24 -0000	1.7
  @@ -70,6 +70,7 @@
   import org.apache.commons.httpclient.HttpException;
   
   import org.apache.util.XMLPrinter;
  +import org.apache.util.WebdavStatus;
   
   
   /**
  @@ -165,5 +166,23 @@
           return result;
       }
   
  +    /**
  +     * Parse response.
  +     *
  +     * @param input Input stream
  +     */
  +    public void parseResponse(InputStream input)
  +        throws IOException, HttpException {
  +        try
  +        {
  +            if (getStatusCode() == WebdavStatus.SC_CONFLICT     ||
  +                getStatusCode() == WebdavStatus.SC_FORBIDDEN ) {
  +                parseXMLResponse(input);
  +            }
  +        }
  +        catch (IOException e) {
  +                // FIX ME:  provide a way to deliver non xml data
  +        }
  +    }
   
   }
  
  
  
  1.8       +24 -3     jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/CheckoutMethod.java
  
  Index: CheckoutMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/CheckoutMethod.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- CheckoutMethod.java	1 Aug 2002 10:48:38 -0000	1.7
  +++ CheckoutMethod.java	14 Aug 2002 15:22:24 -0000	1.8
  @@ -69,6 +69,7 @@
   import org.apache.commons.httpclient.State;
   import org.apache.commons.httpclient.HttpException;
   
  +import org.apache.util.WebdavStatus;
   
   
   /**
  @@ -139,5 +140,25 @@
               return query;
           } else return "";
       }
  +
  +    /**
  +     * Parse response.
  +     *
  +     * @param input Input stream
  +     */
  +    public void parseResponse(InputStream input)
  +        throws IOException, HttpException {
  +        try
  +        {
  +            if (getStatusCode() == WebdavStatus.SC_CONFLICT     ||
  +                getStatusCode() == WebdavStatus.SC_FORBIDDEN ) {
  +                parseXMLResponse(input);
  +            }
  +        }
  +        catch (IOException e) {
  +                // FIX ME:  provide a way to deliver non xml data
  +        }
  +    }
  +
   
   }
  
  
  
  1.9       +27 -3     jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/DeleteMethod.java
  
  Index: DeleteMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/DeleteMethod.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- DeleteMethod.java	25 Apr 2002 21:12:29 -0000	1.8
  +++ DeleteMethod.java	14 Aug 2002 15:22:24 -0000	1.9
  @@ -65,7 +65,12 @@
   
   import org.apache.commons.httpclient.State;
   import org.apache.commons.httpclient.Header;
  +import org.apache.commons.httpclient.HttpException;
   
  +import org.apache.util.WebdavStatus;
  +
  +import java.io.InputStream;
  +import java.io.IOException;
   
   /**
    * DELETE Method.  The delete method can be sent to either a collection or
  @@ -126,6 +131,25 @@
           name = "DELETE";
       }
   
  +    /**
  +     * Parse response.
  +     *
  +     * @param input Input stream
  +     */
  +    public void parseResponse(InputStream input)
  +        throws IOException, HttpException {
  +        try
  +        {
  +            if (getStatusCode() == WebdavStatus.SC_CONFLICT     ||
  +                getStatusCode() == WebdavStatus.SC_MULTI_STATUS ||
  +                getStatusCode() == WebdavStatus.SC_FORBIDDEN ) {
  +                parseXMLResponse(input);
  +            }
  +        }
  +        catch (IOException e) {
  +                // FIX ME:  provide a way to deliver non xml data
  +        }
  +    }
   
       // --------------------------------------------------- WebdavMethod Methods
   
  
  
  
  1.4       +28 -3     jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/LabelMethod.java
  
  Index: LabelMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/LabelMethod.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- LabelMethod.java	1 Aug 2002 10:48:38 -0000	1.3
  +++ LabelMethod.java	14 Aug 2002 15:22:24 -0000	1.4
  @@ -67,6 +67,10 @@
   import java.io.IOException;
   
   import org.apache.commons.httpclient.HttpMethodBase;
  +import org.apache.commons.httpclient.HttpException;
  +
  +import org.apache.util.WebdavStatus;
  +
   
   /**
    * The MkWorkspace method is used to create a new workspace. New workspaces
  @@ -112,6 +116,27 @@
           super(path);
           name = "LABEL";
       }
  +
  +    /**
  +     * Parse response.
  +     *
  +     * @param input Input stream
  +     */
  +    public void parseResponse(InputStream input)
  +        throws IOException, HttpException {
  +        try
  +        {
  +            if (getStatusCode() == WebdavStatus.SC_CONFLICT     ||
  +                getStatusCode() == WebdavStatus.SC_MULTI_STATUS ||
  +                getStatusCode() == WebdavStatus.SC_FORBIDDEN ) {
  +                parseXMLResponse(input);
  +            }
  +        }
  +        catch (IOException e) {
  +                // FIX ME:  provide a way to deliver non xml data
  +        }
  +    }
  +
       
       
       // --------------------------------------------------- WebdavMethod Methods
  
  
  
  1.31      +7 -4      jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/LockMethod.java
  
  Index: LockMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/LockMethod.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- LockMethod.java	25 Apr 2002 21:27:30 -0000	1.30
  +++ LockMethod.java	14 Aug 2002 15:22:24 -0000	1.31
  @@ -537,7 +537,7 @@
   //      if (status == HttpStatus.SC_OK ||
   //          status == HttpStatus.SC_MULTI_STATUS ||
   //          status == HttpStatus.SC_CONFLICT) {
  -        if (status == HttpStatus.SC_OK ||
  +        if (status == HttpStatus.SC_OK      ||
               status == HttpStatus.SC_CREATED ||
               status == HttpStatus.SC_MULTI_STATUS ) {
   
  @@ -563,5 +563,8 @@
               }
           }
       }
  +    
  +    
  +    
   }
   
  
  
  
  1.6       +25 -3     jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/MkWorkspaceMethod.java
  
  Index: MkWorkspaceMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/MkWorkspaceMethod.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- MkWorkspaceMethod.java	1 Aug 2002 10:48:38 -0000	1.5
  +++ MkWorkspaceMethod.java	14 Aug 2002 15:22:24 -0000	1.6
  @@ -67,6 +67,10 @@
   import java.io.IOException;
   
   import org.apache.commons.httpclient.HttpMethodBase;
  +import org.apache.commons.httpclient.HttpException;
  +
  +import org.apache.util.WebdavStatus;
  +
   
   /**
    * The MkWorkspace method is used to create a new workspace. New workspaces
  @@ -117,6 +121,24 @@
       // --------------------------------------------------- WebdavMethod Methods
       
   
  +    /**
  +     * Parse response.
  +     *
  +     * @param input Input stream
  +     */
  +    public void parseResponse(InputStream input)
  +        throws IOException, HttpException {
  +        try
  +        {
  +            if (getStatusCode() == WebdavStatus.SC_CONFLICT     ||
  +                getStatusCode() == WebdavStatus.SC_FORBIDDEN ) {
  +                parseXMLResponse(input);
  +            }
  +        }
  +        catch (IOException e) {
  +                // FIX ME:  provide a way to deliver non xml data
  +        }
  +    }
   
   
   }
  
  
  
  1.12      +22 -3     jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/OptionsMethod.java
  
  Index: OptionsMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/OptionsMethod.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- OptionsMethod.java	12 Aug 2002 11:45:39 -0000	1.11
  +++ OptionsMethod.java	14 Aug 2002 15:22:24 -0000	1.12
  @@ -75,6 +75,7 @@
   import org.apache.commons.httpclient.HttpMethodBase;
   import org.apache.commons.httpclient.State;
   import org.apache.commons.httpclient.Header;
  +import org.apache.commons.httpclient.HttpException;
   
   import org.apache.util.XMLPrinter;
   
  @@ -239,6 +240,24 @@
           return davCapabilities.elements();
       }
       
  +    /**
  +     * Parse response.
  +     *
  +     * @param input Input stream
  +     */
  +    public void parseResponse(InputStream input)
  +        throws IOException, HttpException {
  +        try
  +        {
  +            if (getStatusCode() == WebdavStatus.SC_OK ) {
  +                parseXMLResponse(input);
  +            }
  +        }
  +        catch (IOException e) {
  +                // FIX ME:  provide a way to deliver non xml data
  +        }
  +    }
  +
       
       // --------------------------------------------------- WebdavMethod Methods
       
  
  
  
  1.22      +28 -3     jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/PropPatchMethod.java
  
  Index: PropPatchMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/PropPatchMethod.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- PropPatchMethod.java	25 Apr 2002 21:27:30 -0000	1.21
  +++ PropPatchMethod.java	14 Aug 2002 15:22:24 -0000	1.22
  @@ -70,10 +70,14 @@
   import javax.xml.parsers.DocumentBuilder;
   import javax.xml.parsers.ParserConfigurationException;
   
  +
  +
   import org.apache.util.XMLPrinter;
  +import org.apache.util.WebdavStatus;
   
   import org.apache.commons.httpclient.State;
   import org.apache.commons.httpclient.Header;
  +import org.apache.commons.httpclient.HttpException;
   
   
   /**
  @@ -283,6 +287,27 @@
           query = printer.toString();
   
           return query;
  +    }
  +
  +
  +    /**
  +     * Parse response.
  +     *
  +     * @param input Input stream
  +     */
  +    public void parseResponse(InputStream input)
  +        throws IOException, HttpException {
  +        try
  +        {
  +            if (getStatusCode() == WebdavStatus.SC_CONFLICT     ||
  +                getStatusCode() == WebdavStatus.SC_MULTI_STATUS ||
  +                getStatusCode() == WebdavStatus.SC_FORBIDDEN ) {
  +                parseXMLResponse(input);
  +            }
  +        }
  +        catch (IOException e) {
  +                // FIX ME:  provide a way to deliver non xml data
  +        }
       }
   
   
  
  
  
  1.6       +32 -6     jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/SearchMethod.java
  
  Index: SearchMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/SearchMethod.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- SearchMethod.java	25 Apr 2002 21:27:30 -0000	1.5
  +++ SearchMethod.java	14 Aug 2002 15:22:24 -0000	1.6
  @@ -72,8 +72,12 @@
   
   import org.apache.util.XMLPrinter;
   
  +import org.apache.util.WebdavStatus;
  +
   import org.apache.commons.httpclient.Header;
   import org.apache.commons.httpclient.State;
  +import org.apache.commons.httpclient.HttpException;
  +
   
   import org.apache.webdav.lib.Property;
   import org.apache.webdav.lib.properties.GetLastModifiedProperty;
  @@ -86,7 +90,7 @@
    * request defines the query. The server responds with a text/xml entity
    * matching the WebDAV PROPFIND response.
    *
  - * <P>     According to 
  + * <P>     According to
    * <ahref="http://www.webdav.org/dasl/protocol/draft-dasl-protocol-00.html">
    * the DASL draft</a> a typical request looks like this:
    *
  @@ -113,7 +117,7 @@
    * </PRE>
    *
    * <P>     However, other query grammars may be used. A typical request using
  - * the 
  + * the
    * <ahref="http://msdn.microsoft.com/library/default.asp?URL=/library/psdk/exchsv2k/_exch2k_sql_web_storage_system_sql.htm">
    * SQL-based grammar</a> implemented in Microsoft's Web Storage System
    * (currently shipping with Exchange 2000 and SharePoint Portal Server)
  @@ -168,7 +172,7 @@
       /**
        * Construct a SearchMethod using the given XML request body.
        *
  -     * @param path  Relative path to the WebDAV resource 
  +     * @param path  Relative path to the WebDAV resource
        * (presumably a collection).
        * @param query Complete request body in XML including a search query in
        * your favorite grammar.
  @@ -263,6 +267,28 @@
           }
   
       }
  +
  +    /**
  +     * Parse response.
  +     *
  +     * @param input Input stream
  +     */
  +    public void parseResponse(InputStream input)
  +        throws IOException, HttpException {
  +        try
  +        {
  +            if (getStatusCode() == WebdavStatus.SC_BAD_REQUEST ||
  +                getStatusCode() == WebdavStatus.SC_MULTI_STATUS ||
  +                getStatusCode() == WebdavStatus.SC_FORBIDDEN ||
  +                getStatusCode() == WebdavStatus.SC_CONFLICT ) {
  +                parseXMLResponse(input);
  +            }
  +        }
  +        catch (IOException e) {
  +                // FIX ME:  provide a way to deliver non xml data
  +        }
  +    }
  +
   
   
   }
  
  
  
  1.7       +24 -3     jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/UncheckoutMethod.java
  
  Index: UncheckoutMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/UncheckoutMethod.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- UncheckoutMethod.java	1 Aug 2002 10:48:38 -0000	1.6
  +++ UncheckoutMethod.java	14 Aug 2002 15:22:24 -0000	1.7
  @@ -69,6 +69,9 @@
   import org.apache.commons.httpclient.State;
   import org.apache.commons.httpclient.HttpException;
   
  +import org.apache.util.WebdavStatus;
  +
  +
   /**
    * The Checkout method can be applied to a checked-in version-controlled
    * resource.
  @@ -139,6 +142,24 @@
   
       }
   
  +    /**
  +     * Parse response.
  +     *
  +     * @param input Input stream
  +     */
  +    public void parseResponse(InputStream input)
  +        throws IOException, HttpException {
  +        try
  +        {
  +            if (getStatusCode() == WebdavStatus.SC_CONFLICT     ||
  +                getStatusCode() == WebdavStatus.SC_FORBIDDEN ) {
  +                parseXMLResponse(input);
  +            }
  +        }
  +        catch (IOException e) {
  +                // FIX ME:  provide a way to deliver non xml data
  +        }
  +    }
   
   
   }
  
  
  
  1.3       +23 -3     jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/UpdateMethod.java
  
  Index: UpdateMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/UpdateMethod.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- UpdateMethod.java	1 Aug 2002 09:56:10 -0000	1.2
  +++ UpdateMethod.java	14 Aug 2002 15:22:24 -0000	1.3
  @@ -69,6 +69,7 @@
   import org.apache.commons.httpclient.State;
   import org.apache.commons.httpclient.HttpException;
   
  +import org.apache.util.WebdavStatus;
   
   
   /**
  @@ -140,6 +141,25 @@
           } else return "";
       }
   
  +    /**
  +     * Parse response.
  +     *
  +     * @param input Input stream
  +     */
  +    public void parseResponse(InputStream input)
  +        throws IOException, HttpException {
  +        try
  +        {
  +            if (getStatusCode() == WebdavStatus.SC_CONFLICT     ||
  +                getStatusCode() == WebdavStatus.SC_MULTI_STATUS ||
  +                getStatusCode() == WebdavStatus.SC_FORBIDDEN ) {
  +                parseXMLResponse(input);
  +            }
  +        }
  +        catch (IOException e) {
  +                // FIX ME:  provide a way to deliver non xml data
  +        }
  +    }
   
   
   }
  
  
  
  1.7       +23 -3     jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/VersionControlMethod.java
  
  Index: VersionControlMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/VersionControlMethod.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- VersionControlMethod.java	1 Aug 2002 10:48:38 -0000	1.6
  +++ VersionControlMethod.java	14 Aug 2002 15:22:24 -0000	1.7
  @@ -71,6 +71,8 @@
   
   import org.apache.util.XMLPrinter;
   
  +import org.apache.util.WebdavStatus;
  +
   
   /**
   
  @@ -172,6 +174,24 @@
   
       }
   
  +    /**
  +     * Parse response.
  +     *
  +     * @param input Input stream
  +     */
  +    public void parseResponse(InputStream input)
  +        throws IOException, HttpException {
  +        try
  +        {
  +            if (getStatusCode() == WebdavStatus.SC_CONFLICT     ||
  +                getStatusCode() == WebdavStatus.SC_FORBIDDEN ) {
  +                parseXMLResponse(input);
  +            }
  +        }
  +        catch (IOException e) {
  +                // FIX ME:  provide a way to deliver non xml data
  +        }
  +    }
   
   
   }
  
  
  
  1.33      +5 -13     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.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- XMLResponseMethodBase.java	12 Aug 2002 11:45:39 -0000	1.32
  +++ XMLResponseMethodBase.java	14 Aug 2002 15:22:24 -0000	1.33
  @@ -222,20 +222,12 @@
           throws IOException, HttpException {
           try
           {
  -            if (getStatusCode() == WebdavStatus.SC_MULTI_STATUS ||
  -                getStatusCode() == WebdavStatus.SC_CONFLICT     ||
  -                getStatusCode() == WebdavStatus.SC_OK           ||
  -                getStatusCode() == WebdavStatus.SC_BAD_REQUEST  ||
  -                getStatusCode() == WebdavStatus.SC_FORBIDDEN ) {
  +            if (getStatusCode() == WebdavStatus.SC_MULTI_STATUS ) {
                   parseXMLResponse(input);
               }
           }
           catch (IOException e) {
  -            if (getStatusCode() == WebdavStatus.SC_CONFLICT     ||
  -                getStatusCode() == WebdavStatus.SC_FORBIDDEN ) {
  -                // FIX ME:  provide a method to deliver non xml data
  -                responseDocument = null; // ignore the exception (body may be html)
  -            }
  +                // FIX ME:  provide a way to deliver non xml data
           }
       }
   
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>