You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ma...@apache.org on 2002/03/28 04:53:13 UTC

cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods UrlDeleteMethod.java UrlGetMethod.java UrlHeadMethod.java UrlOptionsMethod.java UrlPostMethod.java UrlPutMethod.java

marcsaeg    02/03/27 19:53:13

  Modified:    httpclient/src/java/org/apache/commons/httpclient
                        HttpUrlMethod.java
               httpclient/src/java/org/apache/commons/httpclient/methods
                        UrlDeleteMethod.java UrlGetMethod.java
                        UrlHeadMethod.java UrlOptionsMethod.java
                        UrlPostMethod.java UrlPutMethod.java
  Log:
  The HttpUrlMethod derived classes now set the query string if the URL passed
  to setUrl() contains a query string.
  
  Revision  Changes    Path
  1.2       +6 -4      jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpUrlMethod.java
  
  Index: HttpUrlMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpUrlMethod.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- HttpUrlMethod.java	22 Feb 2002 19:24:23 -0000	1.1
  +++ HttpUrlMethod.java	28 Mar 2002 03:53:13 -0000	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpUrlMethod.java,v 1.1 2002/02/22 19:24:23 marcsaeg Exp $
  - * $Revision: 1.1 $
  - * $Date: 2002/02/22 19:24:23 $
  + * $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpUrlMethod.java,v 1.2 2002/03/28 03:53:13 marcsaeg Exp $
  + * $Revision: 1.2 $
  + * $Date: 2002/03/28 03:53:13 $
    * ====================================================================
    *
    * The Apache Software License, Version 1.1
  @@ -77,7 +77,9 @@
   public interface HttpUrlMethod extends HttpMethod
   {
       /**
  -     * Sets the URL.
  +     * Sets the URL.  Calls the underlying HttpMethod.setPath()
  +     * with the url's path.  If the url contains a query string
  +     * the underlying HttpMethod.setQueryString() is called.
        *
        * @param url - the URL for this request.
        */
  
  
  
  1.2       +11 -3     jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlDeleteMethod.java
  
  Index: UrlDeleteMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlDeleteMethod.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- UrlDeleteMethod.java	22 Feb 2002 19:24:23 -0000	1.1
  +++ UrlDeleteMethod.java	28 Mar 2002 03:53:13 -0000	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlDeleteMethod.java,v 1.1 2002/02/22 19:24:23 marcsaeg Exp $
  - * $Revision: 1.1 $
  - * $Date: 2002/02/22 19:24:23 $
  + * $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlDeleteMethod.java,v 1.2 2002/03/28 03:53:13 marcsaeg Exp $
  + * $Revision: 1.2 $
  + * $Date: 2002/03/28 03:53:13 $
    * ====================================================================
    *
    * The Apache Software License, Version 1.1
  @@ -95,12 +95,20 @@
       }
   
       /**
  +     * Sets the URL.  Calls the underlying HttpMethod.setPath()
  +     * with the url's path.  If the url contains a query string
  +     * the underlying HttpMethod.setQueryString() is called.
        *
  +     * @param url - the URL for this request.
        */
       public void setUrl(String url) throws MalformedURLException
       {
           setPath(URIUtil.getPath(url));
           this.url = url;
  +        String query = new URL(url).getQuery();
  +        if(query != null && query.length() > 0){
  +            super.setQueryString(query);
  +        }
       }
   
       /**
  
  
  
  1.2       +15 -7     jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlGetMethod.java
  
  Index: UrlGetMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlGetMethod.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- UrlGetMethod.java	22 Feb 2002 19:24:23 -0000	1.1
  +++ UrlGetMethod.java	28 Mar 2002 03:53:13 -0000	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlGetMethod.java,v 1.1 2002/02/22 19:24:23 marcsaeg Exp $
  - * $Revision: 1.1 $
  - * $Date: 2002/02/22 19:24:23 $
  + * $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlGetMethod.java,v 1.2 2002/03/28 03:53:13 marcsaeg Exp $
  + * $Revision: 1.2 $
  + * $Date: 2002/03/28 03:53:13 $
    * ====================================================================
    *
    * The Apache Software License, Version 1.1
  @@ -129,18 +129,26 @@
       }
   
       /**
  -     * Set the URL for this method.
  -     * @param url - a fully specified URL
  +     * Sets the URL.  Calls the underlying HttpMethod.setPath()
  +     * with the url's path.  If the url contains a query string
  +     * the underlying HttpMethod.setQueryString() is called.
  +     *
  +     * @param url - the URL for this request.
        */
       public void setUrl(String url) throws MalformedURLException
       {
           super.setPath(URIUtil.getPath(url));
           this.url = url;
  +        String query = new URL(url).getQuery();
  +        if(query != null && query.length() > 0){
  +            super.setQueryString(query);
  +        }
       }
   
       /**
  -     * Get the URL
  -     * @return the url
  +     * Returns this request's URL.
  +     * 
  +     * @return the request's URL.
        */
       public String getUrl()
       {
  
  
  
  1.2       +16 -7     jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlHeadMethod.java
  
  Index: UrlHeadMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlHeadMethod.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- UrlHeadMethod.java	22 Feb 2002 19:24:23 -0000	1.1
  +++ UrlHeadMethod.java	28 Mar 2002 03:53:13 -0000	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlHeadMethod.java,v 1.1 2002/02/22 19:24:23 marcsaeg Exp $
  - * $Revision: 1.1 $
  - * $Date: 2002/02/22 19:24:23 $
  + * $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlHeadMethod.java,v 1.2 2002/03/28 03:53:13 marcsaeg Exp $
  + * $Revision: 1.2 $
  + * $Date: 2002/03/28 03:53:13 $
    * ====================================================================
    *
    * The Apache Software License, Version 1.1
  @@ -62,6 +62,7 @@
   
   package org.apache.commons.httpclient.methods;
   
  +import java.net.URL;
   import java.net.MalformedURLException;
   
   import org.apache.commons.httpclient.URIUtil;
  @@ -95,18 +96,26 @@
       }
   
       /**
  -     * Set the URL for this method.
  -     * @param url - a fully specified URL
  +     * Sets the URL.  Calls the underlying HttpMethod.setPath()
  +     * with the url's path.  If the url contains a query string
  +     * the underlying HttpMethod.setQueryString() is called.
  +     *
  +     * @param url - the URL for this request.
        */
       public void setUrl(String url) throws MalformedURLException
       {
           super.setPath(URIUtil.getPath(url));
           this.url = url;
  +        String query = new URL(url).getQuery();
  +        if(query != null && query.length() > 0){
  +            super.setQueryString(query);
  +        }
       }
   
       /**
  -     * Get the URL
  -     * @return the url
  +     * Returns this request's URL.
  +     * 
  +     * @return the request's URL.
        */
       public String getUrl()
       {
  
  
  
  1.2       +16 -7     jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlOptionsMethod.java
  
  Index: UrlOptionsMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlOptionsMethod.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- UrlOptionsMethod.java	22 Feb 2002 19:24:23 -0000	1.1
  +++ UrlOptionsMethod.java	28 Mar 2002 03:53:13 -0000	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlOptionsMethod.java,v 1.1 2002/02/22 19:24:23 marcsaeg Exp $
  - * $Revision: 1.1 $
  - * $Date: 2002/02/22 19:24:23 $
  + * $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlOptionsMethod.java,v 1.2 2002/03/28 03:53:13 marcsaeg Exp $
  + * $Revision: 1.2 $
  + * $Date: 2002/03/28 03:53:13 $
    * ====================================================================
    *
    * The Apache Software License, Version 1.1
  @@ -62,6 +62,7 @@
   
   package org.apache.commons.httpclient.methods;
   
  +import java.net.URL;
   import java.net.MalformedURLException;
   
   import org.apache.commons.httpclient.URIUtil;
  @@ -95,18 +96,26 @@
       }
   
       /**
  -     * Set the URL for this method.
  -     * @param url - a fully specified URL
  +     * Sets the URL.  Calls the underlying HttpMethod.setPath()
  +     * with the url's path.  If the url contains a query string
  +     * the underlying HttpMethod.setQueryString() is called.
  +     *
  +     * @param url - the URL for this request.
        */
       public void setUrl(String url) throws MalformedURLException
       {
           super.setPath(URIUtil.getPath(url));
           this.url = url;
  +        String query = new URL(url).getQuery();
  +        if(query != null && query.length() > 0){
  +            super.setQueryString(query);
  +        }
       }
   
       /**
  -     * Get the URL
  -     * @return the url
  +     * Returns this request's URL.
  +     * 
  +     * @return the request's URL.
        */
       public String getUrl()
       {
  
  
  
  1.2       +15 -7     jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlPostMethod.java
  
  Index: UrlPostMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlPostMethod.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- UrlPostMethod.java	22 Feb 2002 19:24:23 -0000	1.1
  +++ UrlPostMethod.java	28 Mar 2002 03:53:13 -0000	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlPostMethod.java,v 1.1 2002/02/22 19:24:23 marcsaeg Exp $
  - * $Revision: 1.1 $
  - * $Date: 2002/02/22 19:24:23 $
  + * $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlPostMethod.java,v 1.2 2002/03/28 03:53:13 marcsaeg Exp $
  + * $Revision: 1.2 $
  + * $Date: 2002/03/28 03:53:13 $
    * ====================================================================
    *
    * The Apache Software License, Version 1.1
  @@ -62,6 +62,7 @@
   
   package org.apache.commons.httpclient.methods;
   
  +import java.net.URL;
   import java.net.MalformedURLException;
   
   import org.apache.commons.httpclient.HttpUrlMethod;
  @@ -119,19 +120,26 @@
       }
   
       /**
  -     * Sets the request's URL.
  +     * Sets the URL.  Calls the underlying HttpMethod.setPath()
  +     * with the url's path.  If the url contains a query string
  +     * the underlying HttpMethod.setQueryString() is called.
        *
  -     * @param url the URL for the request
  -    * @exception java.net.MalformedURLException
  +     * @param url - the URL for this request.
        */
       public void setUrl(String url) throws MalformedURLException
       {
           super.setPath(URIUtil.getPath(url));
           this.url = url;
  +        String query = new URL(url).getQuery();
  +        if(query != null && query.length() > 0){
  +            super.setQueryString(query);
  +        }
       }
   
       /**
  -     *
  +     * Returns this request's URL.
  +     * 
  +     * @return the request's URL.
        */
       public String getUrl()
       {
  
  
  
  1.2       +14 -4     jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlPutMethod.java
  
  Index: UrlPutMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlPutMethod.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- UrlPutMethod.java	22 Feb 2002 19:24:23 -0000	1.1
  +++ UrlPutMethod.java	28 Mar 2002 03:53:13 -0000	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlPutMethod.java,v 1.1 2002/02/22 19:24:23 marcsaeg Exp $
  - * $Revision: 1.1 $
  - * $Date: 2002/02/22 19:24:23 $
  + * $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/UrlPutMethod.java,v 1.2 2002/03/28 03:53:13 marcsaeg Exp $
  + * $Revision: 1.2 $
  + * $Date: 2002/03/28 03:53:13 $
    * ====================================================================
    *
    * The Apache Software License, Version 1.1
  @@ -95,16 +95,26 @@
       }
   
       /**
  +     * Sets the URL.  Calls the underlying HttpMethod.setPath()
  +     * with the url's path.  If the url contains a query string
  +     * the underlying HttpMethod.setQueryString() is called.
        *
  +     * @param url - the URL for this request.
        */
       public void setUrl(String url) throws MalformedURLException
       {
           setPath(URIUtil.getPath(url));
           this.url = url;
  +        String query = new URL(url).getQuery();
  +        if(query != null && query.length() > 0){
  +            super.setQueryString(query);
  +        }
       }
   
       /**
  -     *
  +     * Returns this request's URL.
  +     * 
  +     * @return the request's URL.
        */
       public String getUrl()
       {
  
  
  

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