You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ol...@apache.org on 2003/10/03 22:57:36 UTC

cvs commit: jakarta-commons/httpclient/src/test/org/apache/commons/httpclient TestAuthenticator.java TestGetMethodLocal.java TestHttpConnection.java TestHttpConnectionManager.java TestWebappCookie.java TestWebappNoncompliant.java

olegk       2003/10/03 13:57:36

  Modified:    httpclient/src/contrib/org/apache/commons/httpclient/contrib/utils
                        HttpMethodCloner.java
               httpclient/src/examples ClientApp.java CookieDemoApp.java
                        MultipartFileUploadApp.java TrivialApp.java
               httpclient/src/java/org/apache/commons/httpclient
                        HttpClient.java HttpMethod.java HttpMethodBase.java
               httpclient/src/java/org/apache/commons/httpclient/auth
                        DigestScheme.java
               httpclient/src/java/org/apache/commons/httpclient/methods
                        ExpectContinueMethod.java HeadMethod.java
               httpclient/src/java/org/apache/commons/httpclient/params
                        DefaultHttpParams.java HttpMethodParams.java
               httpclient/src/test/org/apache/commons/httpclient
                        TestAuthenticator.java TestGetMethodLocal.java
                        TestHttpConnection.java
                        TestHttpConnectionManager.java
                        TestWebappCookie.java TestWebappNoncompliant.java
  Log:
  PR #15435 (New Preferences Architecture)
  
  Changelog:
  - Massive cleanup of deprecated methods
  - HeadMethod class changed to take advantage of the new preference architecture
  - ExpectContinueMethod class changed to take advantage of the new preference
  architecture
  
  Contributed by Oleg Kalnichevski
  Reviewed by Michael Becke
  
  Revision  Changes    Path
  1.3       +6 -3      jakarta-commons/httpclient/src/contrib/org/apache/commons/httpclient/contrib/utils/HttpMethodCloner.java
  
  Index: HttpMethodCloner.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/contrib/org/apache/commons/httpclient/contrib/utils/HttpMethodCloner.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- HttpMethodCloner.java	1 Apr 2003 19:04:18 -0000	1.2
  +++ HttpMethodCloner.java	3 Oct 2003 20:57:35 -0000	1.3
  @@ -64,6 +64,7 @@
   import org.apache.commons.httpclient.HttpMethod;
   import org.apache.commons.httpclient.HttpMethodBase;
   import org.apache.commons.httpclient.methods.EntityEnclosingMethod;
  +import org.apache.commons.httpclient.params.HttpMethodParams;
   
   /**
    * In this class are only methods to copy a HttpMethod: 
  @@ -83,7 +84,6 @@
           throws java.io.IOException
        {
            copy.setRequestBody(m.getRequestBodyAsString());
  -         copy.setUseExpectHeader(m.getUseExpectHeader());
        }
    
       private static void copyHttpMethodBase(
  @@ -92,8 +92,11 @@
               copy.setHostConfiguration(
                 new HostConfiguration(m.getHostConfiguration()));
           }
  -        copy.setHttp11(m.isHttp11());
  -        copy.setStrictMode(m.isStrictMode());
  +        try {
  +            copy.setParams((HttpMethodParams)m.getParams().clone());
  +        } catch (CloneNotSupportedException e) {
  +            // Should never happen
  +        }
       }
   
       /**
  
  
  
  1.12      +1 -1      jakarta-commons/httpclient/src/examples/ClientApp.java
  
  Index: ClientApp.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/examples/ClientApp.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- ClientApp.java	20 Feb 2003 09:23:29 -0000	1.11
  +++ ClientApp.java	3 Oct 2003 20:57:35 -0000	1.12
  @@ -121,7 +121,7 @@
           
           public HttpClientFrame() {            
               client = new HttpClient(new MultiThreadedHttpConnectionManager());
  -            client.setConnectionTimeout(30000);
  +            client.getParams().setConnectionTimeout(30000);
   
               JPanel panInput = new JPanel(new FlowLayout());
   
  
  
  
  1.11      +4 -4      jakarta-commons/httpclient/src/examples/CookieDemoApp.java
  
  Index: CookieDemoApp.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/examples/CookieDemoApp.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- CookieDemoApp.java	25 Feb 2003 23:33:48 -0000	1.10
  +++ CookieDemoApp.java	3 Oct 2003 20:57:35 -0000	1.11
  @@ -124,7 +124,7 @@
   
           // Get HTTP client instance
           HttpClient httpclient = new HttpClient();
  -        httpclient.setConnectionTimeout(30000);
  +        httpclient.getParams().setConnectionTimeout(30000);
           httpclient.setState(initialState);
           // Get HTTP GET method
           GetMethod httpget = new GetMethod(strURL);
  
  
  
  1.7       +4 -8      jakarta-commons/httpclient/src/examples/MultipartFileUploadApp.java
  
  Index: MultipartFileUploadApp.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/examples/MultipartFileUploadApp.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- MultipartFileUploadApp.java	8 Sep 2003 01:15:11 -0000	1.6
  +++ MultipartFileUploadApp.java	3 Oct 2003 20:57:35 -0000	1.7
  @@ -83,6 +83,7 @@
   import org.apache.commons.httpclient.HttpClient;
   import org.apache.commons.httpclient.HttpStatus;
   import org.apache.commons.httpclient.methods.MultipartPostMethod;
  +import org.apache.commons.httpclient.params.HttpMethodParams;
   
   /**
    *
  @@ -181,18 +182,13 @@
                       MultipartPostMethod filePost =
                           new MultipartPostMethod(targetURL);
   
  -					if (cbxExpectHeader.isSelected()) {
  -						filePost.setUseExpectHeader(true);
  -					}
  -					else {
  -						filePost.setUseExpectHeader(false);
  -					}
  -
  +                    filePost.getParams().setBooleanParameter(HttpMethodParams.USE_EXPECT_CONTINUE,
  +                    cbxExpectHeader.isSelected());
                       try {
                           appendMessage("Uploading " + targetFile.getName() + " to " + targetURL);
                           filePost.addParameter(targetFile.getName(), targetFile);
                           HttpClient client = new HttpClient();
  -                        client.setConnectionTimeout(5000);
  +                        client.getParams().setConnectionTimeout(5000);
                           int status = client.executeMethod(filePost);
                           if (status == HttpStatus.SC_OK) {
                               appendMessage(
  
  
  
  1.14      +4 -4      jakarta-commons/httpclient/src/examples/TrivialApp.java
  
  Index: TrivialApp.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/examples/TrivialApp.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- TrivialApp.java	8 May 2003 18:39:07 -0000	1.13
  +++ TrivialApp.java	3 Oct 2003 20:57:35 -0000	1.14
  @@ -110,7 +110,7 @@
           HttpClient client = new HttpClient();
   
           //establish a connection within 5 seconds
  -        client.setConnectionTimeout(5000);
  +        client.getParams().setConnectionTimeout(5000);
   
           //set the default credentials
           if (creds != null) {
  
  
  
  1.85      +23 -5     jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpClient.java
  
  Index: HttpClient.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpClient.java,v
  retrieving revision 1.84
  retrieving revision 1.85
  diff -u -r1.84 -r1.85
  --- HttpClient.java	23 Sep 2003 19:51:48 -0000	1.84
  +++ HttpClient.java	3 Oct 2003 20:57:35 -0000	1.85
  @@ -534,8 +534,26 @@
           this.httpConnectionManager = httpConnectionManager;
       }
   
  -    public HttpParams getParams() {
  +    /**
  +     * Returns {@link HttpClientParams HTTP protocol parameters} associated with this HttpClient.
  +     * 
  +     * @since 2.1
  +     * 
  +     * @see HttpClientParams
  +     */
  +    public HttpClientParams getParams() {
           return this.params;
  +    }
  +
  +    /**
  +     * Assigns {@link HttpClientParams HTTP protocol parameters} for this HttpClient.
  +     * 
  +     * @since 2.1
  +     * 
  +     * @see HttpClientParams
  +     */
  +    public void setParams(final HttpClientParams params) {
  +        this.params = params;
       }
   
   }
  
  
  
  1.30      +14 -5     jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethod.java
  
  Index: HttpMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethod.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- HttpMethod.java	11 Sep 2003 20:08:32 -0000	1.29
  +++ HttpMethod.java	3 Oct 2003 20:57:35 -0000	1.30
  @@ -523,12 +523,21 @@
   
   
       /**
  -     * Returns a collection of parameters associated with this method
  +     * Returns {@link HttpMethodParams HTTP protocol parameters} associated with this method.
        * 
        * @since 2.1
        * 
        * @see HttpMethodParams
        */
       public HttpMethodParams getParams();
  +
  +    /**
  +     * Assigns {@link HttpMethodParams HTTP protocol parameters} for this method.
  +     * 
  +     * @since 2.1
  +     * 
  +     * @see HttpMethodParams
  +     */
  +    public void setParams(final HttpMethodParams params);
   
   }
  
  
  
  1.181     +16 -5     jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase.java
  
  Index: HttpMethodBase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase.java,v
  retrieving revision 1.180
  retrieving revision 1.181
  diff -u -r1.180 -r1.181
  --- HttpMethodBase.java	11 Sep 2003 20:08:32 -0000	1.180
  +++ HttpMethodBase.java	3 Oct 2003 20:57:35 -0000	1.181
  @@ -2073,7 +2073,7 @@
       }
   
       /**
  -     * Returns {@link HttpParams HTTP protocol parameters}.
  +     * Returns {@link HttpMethodParams HTTP protocol parameters} associated with this method.
        *
        * @return HTTP parameters.
        *
  @@ -2081,6 +2081,17 @@
        */
       public HttpMethodParams getParams() {
           return this.params;
  +    }
  +
  +    /**
  +     * Assigns {@link HttpMethodParams HTTP protocol parameters} for this method.
  +     * 
  +     * @since 2.1
  +     * 
  +     * @see HttpMethodParams
  +     */
  +    public void setParams(final HttpMethodParams params) {
  +        this.params = params;
       }
   
       /**
  
  
  
  1.11      +5 -5      jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/auth/DigestScheme.java
  
  Index: DigestScheme.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/auth/DigestScheme.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- DigestScheme.java	3 Oct 2003 18:44:32 -0000	1.10
  +++ DigestScheme.java	3 Oct 2003 20:57:36 -0000	1.11
  @@ -110,7 +110,7 @@
           'e', 'f'
       };
       
  -    //@TODO: supply a real nonce-count, currently a server will interprete a repeated request as a replay  
  +    //TODO: supply a real nonce-count, currently a server will interprete a repeated request as a replay  
       private static final String NC = "00000001"; //nonce-count is always 1
       private static final int QOP_MISSING = 0;
       private static final int QOP_AUTH_INT = 1;
  @@ -310,7 +310,7 @@
           if (qopVariant == QOP_AUTH_INT) {
               LOG.error("Unhandled qop auth-int");
               //we do not have access to the entity-body or its hash
  -            //@TODO: add Method ":" digest-uri-value ":" H(entity-body)      
  +            //TODO: add Method ":" digest-uri-value ":" H(entity-body)      
           } else {
               a2 = method + ":" + uri;
           }
  
  
  
  1.10      +19 -11    jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/ExpectContinueMethod.java
  
  Index: ExpectContinueMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/ExpectContinueMethod.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ExpectContinueMethod.java	9 Aug 2003 19:37:58 -0000	1.9
  +++ ExpectContinueMethod.java	3 Oct 2003 20:57:36 -0000	1.10
  @@ -69,6 +69,7 @@
   import org.apache.commons.httpclient.HttpMethodBase;
   import org.apache.commons.httpclient.HttpState;
   import org.apache.commons.httpclient.HttpVersion;
  +import org.apache.commons.httpclient.params.HttpMethodParams;
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   
  @@ -102,10 +103,6 @@
   
   public abstract class ExpectContinueMethod extends HttpMethodBase {
       
  -    /** This flag specifies whether "expect: 100-continue" handshake is
  -     * to be used prior to sending the request body */
  -    private boolean useExpectHeader = false;
  -    
       /** LOG object for this class. */
       private static final Log LOG = LogFactory.getLog(ExpectContinueMethod.class);
   
  @@ -143,9 +140,15 @@
        * be used, <tt>false</tt> otherwise.
        * 
        * @since 2.0beta1
  +     * 
  +     * @deprecated Use {@link HttpMethodParams}
  +     * 
  +     * @see #getParams()
  +     * @see HttpMethodParams
  +     * @see HttpMethodParams#USE_EXPECT_CONTINUE
        */
       public boolean getUseExpectHeader() {
  -        return this.useExpectHeader;
  +        return getParams().getBooleanParameter(HttpMethodParams.USE_EXPECT_CONTINUE, false);
       }
   
       /**
  @@ -172,11 +175,16 @@
        * 
        * @param value boolean value
        * 
  -     * 
        * @since 2.0beta1
  +     * 
  +     * @deprecated Use {@link HttpMethodParams}
  +     * 
  +     * @see #getParams()
  +     * @see HttpMethodParams
  +     * @see HttpMethodParams#USE_EXPECT_CONTINUE
        */
       public void setUseExpectHeader(boolean value) {
  -        this.useExpectHeader = value;
  +        getParams().setBooleanParameter(HttpMethodParams.USE_EXPECT_CONTINUE, value);
       }
   
       /**
  @@ -214,7 +222,7 @@
           // = HTTP/1.1 or higher
           // = request body present
   
  -        if (getUseExpectHeader() 
  +        if (getParams().isParameterTrue(HttpMethodParams.USE_EXPECT_CONTINUE) 
           && getHttpVersion().greaterEquals(HttpVersion.HTTP_1_1) 
           && hasRequestContent())
           {
  
  
  
  1.26      +27 -14    jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/HeadMethod.java
  
  Index: HeadMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/HeadMethod.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- HeadMethod.java	11 Sep 2003 20:08:33 -0000	1.25
  +++ HeadMethod.java	3 Oct 2003 20:57:36 -0000	1.26
  @@ -105,8 +105,6 @@
       /** Log object for this class. */
       private static final Log LOG = LogFactory.getLog(HeadMethod.class);
   
  -    private int bodyCheckTimeout = -1; /* Disabled per default */
  -
       //~ Constructors
   
       /**
  @@ -182,16 +180,19 @@
           LOG.trace(
               "enter HeadMethod.readResponseBody(HttpState, HttpConnection)");
           
  -        if (this.bodyCheckTimeout < 0) {
  +        int bodyCheckTimeout = 
  +            getParams().getIntParameter(HttpMethodParams.HEAD_BODY_CHECK_TIMEOUT, -1);
  +
  +        if (bodyCheckTimeout < 0) {
               responseBodyConsumed();
           } else {
               if (LOG.isDebugEnabled()) {
                   LOG.debug("Check for non-compliant response body. Timeout in " 
  -                 + this.bodyCheckTimeout + " ms");    
  +                 + bodyCheckTimeout + " ms");    
               }
               boolean responseAvailable = false;
               try {
  -                responseAvailable = conn.isResponseAvailable(this.bodyCheckTimeout);
  +                responseAvailable = conn.isResponseAvailable(bodyCheckTimeout);
               } catch (IOException e) {
                   LOG.debug("An IOException occurred while testing if a response was available,"
                       + " we will assume one is not.", 
  @@ -212,25 +213,37 @@
       }
       
       /**
  -     * Return non-compliant response body check timeout.
  +     * Returns non-compliant response body check timeout.
        * 
        * @return The period of time in milliseconds to wait for a response 
        *         body from a non-compliant server. <tt>-1</tt> returned when 
        *         non-compliant response body check is disabled
  +     * 
  +     * @deprecated Use {@link HttpMethodParams}
  +     * 
  +     * @see #getParams()
  +     * @see HttpMethodParams
  +     * @see HttpMethodParams#HEAD_BODY_CHECK_TIMEOUT
        */
       public int getBodyCheckTimeout() {
  -        return this.bodyCheckTimeout;
  +        return getParams().getIntParameter(HttpMethodParams.HEAD_BODY_CHECK_TIMEOUT, -1);
       }
   
       /**
  -     * Set non-compliant response body check timeout.
  +     * Sets non-compliant response body check timeout.
        * 
        * @param timeout The period of time in milliseconds to wait for a response 
        *         body from a non-compliant server. <tt>-1</tt> can be used to 
  -     *         disable non-compliant response body check 
  +     *         disable non-compliant response body check
  +     *  
  +     * @deprecated Use {@link HttpMethodParams}
  +     * 
  +     * @see #getParams()
  +     * @see HttpMethodParams
  +     * @see HttpMethodParams#HEAD_BODY_CHECK_TIMEOUT
        */
       public void setBodyCheckTimeout(int timeout) {
  -        this.bodyCheckTimeout = timeout;
  +        getParams().setIntParameter(HttpMethodParams.HEAD_BODY_CHECK_TIMEOUT, timeout);
       }
   
   }
  
  
  
  1.4       +5 -4      jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/params/DefaultHttpParams.java
  
  Index: DefaultHttpParams.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/params/DefaultHttpParams.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DefaultHttpParams.java	23 Sep 2003 19:51:49 -0000	1.3
  +++ DefaultHttpParams.java	3 Oct 2003 20:57:36 -0000	1.4
  @@ -273,6 +273,7 @@
           if (this.parameters != null) {
               clone.parameters = (HashMap)this.parameters.clone(); 
           }
  +        clone.setDefaults(this.defaults);
           return clone;
       }
   }
  
  
  
  1.3       +41 -4     jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/params/HttpMethodParams.java
  
  Index: HttpMethodParams.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/params/HttpMethodParams.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- HttpMethodParams.java	23 Sep 2003 19:51:49 -0000	1.2
  +++ HttpMethodParams.java	3 Oct 2003 20:57:36 -0000	1.3
  @@ -127,6 +127,43 @@
       public static final String REJECT_HEAD_BODY = "http.protocol.reject-head-body"; 
   
       /**
  +     * Sets period of time in milliseconds to wait for a content body sent in response to 
  +     * {@link org.apache.commons.httpclient.methods.HeadMethod HEAD method} from a 
  +     * non-compliant server. If the parameter is not set or set to <tt>-1</tt> non-compliant 
  +     * response body check is disabled.
  +     * This parameter expects a value of type {@link Integer}.
  +     */
  +    public static final String HEAD_BODY_CHECK_TIMEOUT = "http.protocol.head-body-timeout"; 
  +
  +    /**
  +     * <p>
  +     * Activates 'Expect: 100-Continue' handshake for the 
  +     * {@link org.apache.commons.httpclient.methods.ExpectContinueMethod 
  +     * entity enclosing methods}. The purpose of the 'Expect: 100-Continue'
  +     * handshake to allow a client that is sending a request message with 
  +     * a request body to determine if the origin server is willing to 
  +     * accept the request (based on the request headers) before the client
  +     * sends the request body.
  +     * </p>
  +     * 
  +     * <p>
  +     * The use of the 'Expect: 100-continue' handshake can result in 
  +     * noticable peformance improvement for entity enclosing requests
  +     * (such as POST and PUT) that require the target server's 
  +     * authentication.
  +     * </p>
  +     * 
  +     * <p>
  +     * 'Expect: 100-continue' handshake should be used with 
  +     * caution, as it may cause problems with HTTP servers and 
  +     * proxies that do not support HTTP/1.1 protocol.
  +     * </p>
  +     * 
  +     * This parameter expects a value of type {@link Boolean}.
  +     */
  +    public static final String USE_EXPECT_CONTINUE = "http.protocol.expect-continue"; 
  +
  +    /**
        * Creates a new collection of parameters with the collection returned
        * by {@link #getDefaultParams()} as a parent. The collection will defer
        * to its parent for a default value if a particular parameter is not 
  
  
  
  1.32      +4 -6      jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestAuthenticator.java
  
  Index: TestAuthenticator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestAuthenticator.java,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- TestAuthenticator.java	18 Sep 2003 13:56:22 -0000	1.31
  +++ TestAuthenticator.java	3 Oct 2003 20:57:36 -0000	1.32
  @@ -225,7 +225,6 @@
           HttpState state = new HttpState();
           HttpMethod method = new SimpleHttpMethod();
   
  -        state.setAuthenticationPreemptive(true);
           assertTrue(!HttpAuthenticator.authenticateDefault(method, null, state));
           assertTrue(null == method.getRequestHeader("Authorization"));
       }
  @@ -235,7 +234,6 @@
           HttpMethod method = new SimpleHttpMethod();
           state.setCredentials(null, null, new UsernamePasswordCredentials("username","password"));
   
  -        state.setAuthenticationPreemptive(true);
           assertTrue(HttpAuthenticator.authenticateDefault(method, null, state));
           assertTrue(null != method.getRequestHeader("Authorization"));
           String expected = "Basic " + HttpConstants.getString(Base64.encode(HttpConstants.getBytes("username:password")));
  
  
  
  1.13      +4 -6      jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestGetMethodLocal.java
  
  Index: TestGetMethodLocal.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestGetMethodLocal.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- TestGetMethodLocal.java	17 Jul 2003 21:57:42 -0000	1.12
  +++ TestGetMethodLocal.java	3 Oct 2003 20:57:36 -0000	1.13
  @@ -201,12 +201,10 @@
               GetMethod method1 = new GetMethod(path);
               method1.addRequestHeader("Connection", "close");
               client.executeMethod(method1);
  -            assertEquals(0, method1.getRecoverableExceptionCount() );
   
               // issue another GET.
               GetMethod method2 = new GetMethod(path);
               client.executeMethod(method2);
  -            assertEquals(0, method2.getRecoverableExceptionCount() );
           }
           catch (Exception ioe) {
   
  
  
  
  1.11      +1 -1      jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestHttpConnection.java
  
  Index: TestHttpConnection.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestHttpConnection.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- TestHttpConnection.java	17 Sep 2003 03:53:25 -0000	1.10
  +++ TestHttpConnection.java	3 Oct 2003 20:57:36 -0000	1.11
  @@ -129,7 +129,7 @@
           connectionManager.setConnection(new HttpConnection(getHost(), getPort(), testProtocol));
           HttpClient client = createHttpClient(connectionManager);
           client.getHostConfiguration().setHost(getHost(), getPort(), testProtocol);
  -        client.setConnectionTimeout(1);
  +        client.getParams().setConnectionTimeout(1);
           
           try {
               GetMethod get = new GetMethod();
  
  
  
  1.11      +8 -8      jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestHttpConnectionManager.java
  
  Index: TestHttpConnectionManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestHttpConnectionManager.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- TestHttpConnectionManager.java	12 Aug 2003 02:35:17 -0000	1.10
  +++ TestHttpConnectionManager.java	3 Oct 2003 20:57:36 -0000	1.11
  @@ -230,7 +230,7 @@
   
           HttpClient client = createHttpClient(connectionManager);
           // we shouldn't have to wait if a connection is available
  -        client.setHttpConnectionFactoryTimeout(1);
  +        client.getParams().setConnectionManagerTimeout(1);
   
           GetMethod getMethod = new GetMethod("/");
   
  @@ -279,7 +279,7 @@
   
           HttpClient client = createHttpClient(connectionManager);
           // we shouldn't have to wait if a connection is available
  -        client.setHttpConnectionFactoryTimeout( 1 );
  +        client.getParams().setConnectionManagerTimeout( 1 );
   
           GetMethod getMethod = new GetMethod("/");
   
  @@ -430,7 +430,7 @@
   
           HttpClient client = createHttpClient(connectionManager);
           // we shouldn't have to wait if a connection is available
  -        client.setHttpConnectionFactoryTimeout( 1 );
  +        client.getParams().setConnectionManagerTimeout( 1 );
   
           GetMethod getMethod = new GetMethod("/");
   
  @@ -462,7 +462,7 @@
   
           HttpClient client = createHttpClient(connectionManager);
           // we shouldn't have to wait if a connection is available
  -        client.setHttpConnectionFactoryTimeout( 30000 );
  +        client.getParams().setConnectionManagerTimeout( 30000 );
   
           GetMethod getMethod = new GetMethod("/");
   
  
  
  
  1.12      +17 -18    jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestWebappCookie.java
  
  Index: TestWebappCookie.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestWebappCookie.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- TestWebappCookie.java	5 Mar 2003 04:02:56 -0000	1.11
  +++ TestWebappCookie.java	3 Oct 2003 20:57:36 -0000	1.12
  @@ -66,6 +66,7 @@
   
   import org.apache.commons.httpclient.cookie.CookiePolicy;
   import org.apache.commons.httpclient.methods.*;
  +import org.apache.commons.httpclient.params.HttpMethodParams;
   
   /**
    * This suite of tests depends upon the httpclienttest webapp,
  @@ -109,7 +110,7 @@
   
       public void testSetCookieGet() throws Exception {
           HttpClient client = createHttpClient();
  -        client.setStrictMode(true);
  +        client.getParams().setBooleanParameter(HttpMethodParams.SINGLE_COOKIE_HEADER, true);
   
           GetMethod method = new GetMethod("/" + getWebappContext() + "/cookie/write");
           method.setQueryString("simple=set");
  @@ -130,7 +131,7 @@
   
       public void testSetCookiePost() throws Exception {
           HttpClient client = createHttpClient();
  -        client.setStrictMode(true);
  +        client.getParams().setBooleanParameter(HttpMethodParams.SINGLE_COOKIE_HEADER, true);
   
           PostMethod method = new PostMethod("/" + getWebappContext() + "/cookie/write");
           method.setRequestBody(new NameValuePair[] { new NameValuePair("simple","set") } );
  @@ -151,7 +152,7 @@
   
       public void testSetCookiePut() throws Exception {
           HttpClient client = createHttpClient();
  -        client.setStrictMode(true);
  +        client.getParams().setBooleanParameter(HttpMethodParams.SINGLE_COOKIE_HEADER, true);
   
           PutMethod method = new PutMethod("/" + getWebappContext() + "/cookie/write");
           method.setQueryString("simple=set");
  @@ -172,7 +173,7 @@
   
       public void testSetExpiredCookieGet() throws Exception {
           HttpClient client = createHttpClient();
  -        client.setStrictMode(true);
  +        client.getParams().setBooleanParameter(HttpMethodParams.SINGLE_COOKIE_HEADER, true);
   
           GetMethod method = new GetMethod("/" + getWebappContext() + "/cookie/write");
           method.setQueryString("simple=unset");
  @@ -191,7 +192,7 @@
   
       public void testSetExpiredCookiePut() throws Exception {
           HttpClient client = createHttpClient();
  -        client.setStrictMode(true);
  +        client.getParams().setBooleanParameter(HttpMethodParams.SINGLE_COOKIE_HEADER, true);
   
           PutMethod method = new PutMethod("/" + getWebappContext() + "/cookie/write");
           method.setQueryString("simple=unset");
  @@ -210,7 +211,7 @@
   
       public void testSetUnsetCookieGet() throws Exception {
           HttpClient client = createHttpClient();
  -        client.setStrictMode(true);
  +        client.getParams().setBooleanParameter(HttpMethodParams.SINGLE_COOKIE_HEADER, true);
   
           GetMethod method = new GetMethod("/" + getWebappContext() + "/cookie/write");
           method.setQueryString("simple=set");
  @@ -246,7 +247,7 @@
   
       public void testSetMultiCookieGetStrict() throws Exception {
           HttpClient client = createHttpClient();
  -        client.setStrictMode(true);
  +        client.getParams().setBooleanParameter(HttpMethodParams.SINGLE_COOKIE_HEADER, true);
   
           GetMethod method = new GetMethod("/" + getWebappContext() + "/cookie/write");
           method.setQueryString("simple=set&domain=set");
  @@ -309,7 +310,7 @@
   
       public void testSetMultiCookiePut() throws Exception {
           HttpClient client = createHttpClient();
  -        client.setStrictMode(true);
  +        client.getParams().setBooleanParameter(HttpMethodParams.SINGLE_COOKIE_HEADER, true);
   
           PutMethod method = new PutMethod("/" + getWebappContext() + "/cookie/write");
           method.setQueryString("simple=set&domain=set");
  @@ -333,7 +334,7 @@
   
       public void testSendCookieGet() throws Exception {
           HttpClient client = createHttpClient();
  -        client.setStrictMode(true);
  +        client.getParams().setBooleanParameter(HttpMethodParams.SINGLE_COOKIE_HEADER, true);
   
           GetMethod method = new GetMethod("/" + getWebappContext() + "/cookie/write");
           method.setQueryString("simple=set");
  @@ -368,7 +369,7 @@
   
       public void testMultiSendCookieGet() throws Exception {
           HttpClient client = createHttpClient();
  -        client.setStrictMode(true);
  +        client.getParams().setBooleanParameter(HttpMethodParams.SINGLE_COOKIE_HEADER, true);
   
           GetMethod method = new GetMethod("/" + getWebappContext() + "/cookie/write");
           method.setQueryString("simple=set&domain=set");
  @@ -407,7 +408,7 @@
   
       public void testDeleteCookieGet() throws Exception {
           HttpClient client = createHttpClient();
  -        client.setStrictMode(true);
  +        client.getParams().setBooleanParameter(HttpMethodParams.SINGLE_COOKIE_HEADER, true);
   
   
           {
  @@ -485,9 +486,7 @@
   
       public void testDeleteCookiePut() throws Exception {
           HttpClient client = createHttpClient();
  -        client.setStrictMode(true);
  -
  -
  +        client.getParams().setBooleanParameter(HttpMethodParams.SINGLE_COOKIE_HEADER, true);
           {
               PutMethod method = new PutMethod("/" + getWebappContext() + "/cookie/write");
               method.setQueryString("simple=set&domain=set");
  
  
  
  1.6       +5 -4      jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestWebappNoncompliant.java
  
  Index: TestWebappNoncompliant.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestWebappNoncompliant.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestWebappNoncompliant.java	8 May 2003 17:33:53 -0000	1.5
  +++ TestWebappNoncompliant.java	3 Oct 2003 20:57:36 -0000	1.6
  @@ -60,6 +60,7 @@
   
   import junit.framework.*;
   import org.apache.commons.httpclient.methods.*;
  +import org.apache.commons.httpclient.params.HttpMethodParams;
   
   /**
    * Tests cases intended to test if entity enclosing methods
  @@ -97,7 +98,7 @@
       {
           HttpClient client = createHttpClient();
           NoncompliantPostMethod method = new NoncompliantPostMethod("/" + getWebappContext() + "/body");
  -        method.setUseExpectHeader(true);
  +        method.getParams().setBooleanParameter(HttpMethodParams.USE_EXPECT_CONTINUE, true);
           method.setRequestBody("This is data to be sent in the body of an HTTP POST.");
           try {
               client.executeMethod(method);
  @@ -137,7 +138,7 @@
         throws Exception {
             HttpClient client = createHttpClient();
             HeadMethod method = new NoncompliantHeadMethod("/" + getWebappContext() + "/redirect");
  -          method.setBodyCheckTimeout(50);
  +          method.getParams().setIntParameter(HttpMethodParams.HEAD_BODY_CHECK_TIMEOUT, 50);
             client.executeMethod(method);
             assertEquals(200,method.getStatusCode());
             method.releaseConnection();
  @@ -151,9 +152,9 @@
       public void testNoncompliantHeadStrictMode() 
         throws Exception {
             HttpClient client = createHttpClient();
  -          client.setStrictMode(true);
  +          client.getParams().setBooleanParameter(HttpMethodParams.REJECT_HEAD_BODY, true);
             HeadMethod method = new NoncompliantHeadMethod("/" + getWebappContext() + "/body");
  -          method.setBodyCheckTimeout(50);
  +          method.getParams().setIntParameter(HttpMethodParams.HEAD_BODY_CHECK_TIMEOUT, 50);
             try {
                 client.executeMethod(method);
                 fail("HttpException should have been thrown"); 
  
  
  

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