Index: examples/ClientApp.java =================================================================== RCS file: /home/cvspublic/jakarta-commons/httpclient/src/examples/ClientApp.java,v retrieving revision 1.12 diff -u -r1.12 ClientApp.java --- examples/ClientApp.java 3 Oct 2003 20:57:35 -0000 1.12 +++ examples/ClientApp.java 22 Oct 2003 20:47:00 -0000 @@ -121,7 +121,8 @@ public HttpClientFrame() { client = new HttpClient(new MultiThreadedHttpConnectionManager()); - client.getParams().setConnectionTimeout(30000); + client.getHttpConnectionManager().getParams(). + setConnectionTimeout(30000); JPanel panInput = new JPanel(new FlowLayout()); Index: examples/CookieDemoApp.java =================================================================== RCS file: /home/cvspublic/jakarta-commons/httpclient/src/examples/CookieDemoApp.java,v retrieving revision 1.12 diff -u -r1.12 CookieDemoApp.java --- examples/CookieDemoApp.java 20 Oct 2003 22:17:11 -0000 1.12 +++ examples/CookieDemoApp.java 22 Oct 2003 20:47:01 -0000 @@ -1,5 +1,5 @@ /* - * $Header: /home/cvspublic/jakarta-commons/httpclient/src/examples/CookieDemoApp.java,v 1.12 2003/10/20 22:17:11 olegk Exp $ + * $Header: /home/cvs/jakarta-commons/httpclient/src/examples/CookieDemoApp.java,v 1.12 2003/10/20 22:17:11 olegk Exp $ * $Revision: 1.12 $ * $Date: 2003/10/20 22:17:11 $ * ==================================================================== @@ -111,7 +111,8 @@ // Get HTTP client instance HttpClient httpclient = new HttpClient(); - httpclient.getParams().setConnectionTimeout(30000); + httpclient.getHttpConnectionManager().getParams() + .setConnectionTimeout(30000); httpclient.setState(initialState); // RFC 2101 cookie management spec is used per default Index: examples/MultipartFileUploadApp.java =================================================================== RCS file: /home/cvspublic/jakarta-commons/httpclient/src/examples/MultipartFileUploadApp.java,v retrieving revision 1.7 diff -u -r1.7 MultipartFileUploadApp.java --- examples/MultipartFileUploadApp.java 3 Oct 2003 20:57:35 -0000 1.7 +++ examples/MultipartFileUploadApp.java 22 Oct 2003 20:47:03 -0000 @@ -188,7 +188,8 @@ appendMessage("Uploading " + targetFile.getName() + " to " + targetURL); filePost.addParameter(targetFile.getName(), targetFile); HttpClient client = new HttpClient(); - client.getParams().setConnectionTimeout(5000); + client.getHttpConnectionManager().getParams() + .setConnectionTimeout(5000); int status = client.executeMethod(filePost); if (status == HttpStatus.SC_OK) { appendMessage( Index: examples/TrivialApp.java =================================================================== RCS file: /home/cvspublic/jakarta-commons/httpclient/src/examples/TrivialApp.java,v retrieving revision 1.14 diff -u -r1.14 TrivialApp.java --- examples/TrivialApp.java 3 Oct 2003 20:57:35 -0000 1.14 +++ examples/TrivialApp.java 22 Oct 2003 20:47:04 -0000 @@ -1,5 +1,5 @@ /* - * $Header: /home/cvspublic/jakarta-commons/httpclient/src/examples/TrivialApp.java,v 1.14 2003/10/03 20:57:35 olegk Exp $ + * $Header: /home/cvs/jakarta-commons/httpclient/src/examples/TrivialApp.java,v 1.14 2003/10/03 20:57:35 olegk Exp $ * $Revision: 1.14 $ * $Date: 2003/10/03 20:57:35 $ * @@ -110,7 +110,8 @@ HttpClient client = new HttpClient(); //establish a connection within 5 seconds - client.getParams().setConnectionTimeout(5000); + client.getHttpConnectionManager().getParams() + .setConnectionTimeout(5000); //set the default credentials if (creds != null) { Index: java/org/apache/commons/httpclient/HttpClient.java =================================================================== RCS file: /home/cvspublic/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpClient.java,v retrieving revision 1.87 diff -u -r1.87 HttpClient.java --- java/org/apache/commons/httpclient/HttpClient.java 22 Oct 2003 19:31:00 -0000 1.87 +++ java/org/apache/commons/httpclient/HttpClient.java 22 Oct 2003 20:47:07 -0000 @@ -296,12 +296,12 @@ * * @param newTimeoutInMilliseconds Timeout in milliseconds * - * @deprecated Use {@link HttpClientParams#setSoTimeout(int)}, - * {@link HttpClient#getParams()}. + * @deprecated Use {@link HttpConnectionManagerParams#setSoTimeout(int)}, + * {@link HttpConnectionManager#getParams()}. * */ public synchronized void setTimeout(int newTimeoutInMilliseconds) { - this.params.setSoTimeout(newTimeoutInMilliseconds); + this.httpConnectionManager.getParams().setSoTimeout(newTimeoutInMilliseconds); } /** @@ -313,11 +313,11 @@ * * @see HttpConnectionManager#getConnection(HostConfiguration, long) * - * @deprecated Use {@link HttpClientParams#setConnectionManagerTimeout(long)}, - * {@link HttpClient#getParams()} + * @deprecated Use {@link HttpConnectionManagerParams#setConnectionManagerTimeout(long)}, + * {@link HttpConnectionManager#getParams()} */ public synchronized void setHttpConnectionFactoryTimeout(long timeout) { - this.params.setConnectionManagerTimeout(timeout); + this.httpConnectionManager.getParams().setConnectionManagerTimeout(timeout); } /** @@ -327,11 +327,11 @@ * @see HttpConnection#setConnectionTimeout(int) * @param newTimeoutInMilliseconds Timeout in milliseconds. * - * @deprecated Use {@link HttpClientParams#setConnectionTimeout(int)}, - * {@link HttpClient#getParams()}. + * @deprecated Use {@link HttpConnectionManagerParams#setConnectionTimeout(int)}, + * {@link HttpConnectionManager#getParams()}. */ public synchronized void setConnectionTimeout(int newTimeoutInMilliseconds) { - this.params.setConnectionTimeout(newTimeoutInMilliseconds); + this.httpConnectionManager.getParams().setConnectionTimeout(newTimeoutInMilliseconds); } // --------------------------------------------------------- Public Methods Index: java/org/apache/commons/httpclient/params/HttpClientParams.java =================================================================== RCS file: /home/cvspublic/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/params/HttpClientParams.java,v retrieving revision 1.2 diff -u -r1.2 HttpClientParams.java --- java/org/apache/commons/httpclient/params/HttpClientParams.java 23 Sep 2003 19:51:49 -0000 1.2 +++ java/org/apache/commons/httpclient/params/HttpClientParams.java 22 Oct 2003 20:47:09 -0000 @@ -83,45 +83,28 @@ private static final Log LOG = LogFactory.getLog(HttpParams.class); /** - * Sets the socket timeout (SO_TIMEOUT) in milliseconds which is the - * timeout for waiting for data. A timeout value of zero is interpreted as an - * infinite timeout. - * This parameter expects a value of type {@link Integer}. - */ - public static final String SO_TIMEOUT = "http.socket.timeout"; - - /** - * Sets the timeout until a connection is etablished. A value of zero - * means the timeout is not used. The default value is zero. - * This parameter expects a value of type {@link Integer}. - */ - public static final String CONNECTION_TIMEOUT = "http.connection.timeout"; - - /** - * Sets the timeout in milliseconds used when retrieving an - * {@link org.apache.commons.httpclient.HttpConnection HTTP connection} from the - * {@link org.apache.commons.httpclient.HttpConnectionManager HTTP connection manager}. - * This parameter expects a value of type {@link Long}. - */ - public static final String CONNECTION_MANAGER_TIMEOUT = "http.connection-manager.timeout"; - - /** * Defines the default * {@link org.apache.commons.httpclient.HttpConnectionManager HTTP connection manager} * class. + *
* This parameter expects a value of type {@link Class}. + *
*/ public static final String CONNECTION_MANAGER_CLASS = "http.connection-manager.class"; /** * Defines whether authentication should be attempted preemptively. + ** This parameter expects a value of type {@link Boolean}. + *
*/ public static final String PREEMPTIVE_AUTHENTICATION = "http.authentication.preemptive"; /** * Defines whether relative redirects should be rejected. + ** This parameter expects a value of type {@link Boolean}. + *
*/ public static final String REJECT_RELATIVE_REDIRECT = "http.protocol.reject-relative-redirect"; @@ -150,70 +133,6 @@ */ public HttpClientParams(HttpParams defaults) { super(defaults); - } - - /** - * Returns the socket timeout (SO_TIMEOUT) in milliseconds which is the - * timeout for waiting for data. A timeout value of zero is interpreted as an - * infinite timeout. - * - * @return timeout in milliseconds - */ - public int getSoTimeout() { - return getIntParameter(SO_TIMEOUT, 0); - } - - /** - * Sets the socket timeout (SO_TIMEOUT) in milliseconds which is the - * timeout for waiting for data. A timeout value of zero is interpreted as an - * infinite timeout. - * - * @param timeout Timeout in milliseconds - */ - public void setSoTimeout(int timeout) { - setIntParameter(SO_TIMEOUT, timeout); - } - - /** - * Returns the timeout until a connection is etablished. A value of zero - * means the timeout is not used. The default value is zero. - * - * @return timeout in milliseconds. - */ - public int getConnectionTimeout() { - return getIntParameter(CONNECTION_TIMEOUT, 0); - } - - /** - * Sets the timeout until a connection is etablished. A value of zero - * means the timeout is not used. The default value is zero. - * - * @param timeout Timeout in milliseconds. - */ - public void setConnectionTimeout(int timeout) { - setIntParameter(CONNECTION_TIMEOUT, timeout); - } - - /** - * Returns the timeout in milliseconds used when retrieving an - * {@link org.apache.commons.httpclient.HttpConnection HTTP connection} from the - * {@link org.apache.commons.httpclient.HttpConnectionManager HTTP connection manager}. - * - * @return timeout in milliseconds. - */ - public long getConnectionManagerTimeout() { - return getLongParameter(CONNECTION_MANAGER_TIMEOUT, 0); - } - - /** - * Sets the timeout in milliseconds used when retrieving an - * {@link org.apache.commons.httpclient.HttpConnection HTTP connection} from the - * {@link org.apache.commons.httpclient.HttpConnectionManager HTTP connection manager}. - * - * @param timeout the timeout in milliseconds - */ - public void setConnectionManagerTimeout(long timeout) { - setLongParameter(CONNECTION_MANAGER_TIMEOUT, timeout); } /** Index: java/org/apache/commons/httpclient/params/HttpConnectionManagerParams.java =================================================================== RCS file: /home/cvspublic/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/params/HttpConnectionManagerParams.java,v retrieving revision 1.1 diff -u -r1.1 HttpConnectionManagerParams.java --- java/org/apache/commons/httpclient/params/HttpConnectionManagerParams.java 22 Oct 2003 19:35:33 -0000 1.1 +++ java/org/apache/commons/httpclient/params/HttpConnectionManagerParams.java 22 Oct 2003 20:47:10 -0000 @@ -1,5 +1,5 @@ /* - * $Header: /home/cvspublic/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/params/HttpConnectionManagerParams.java,v 1.1 2003/10/22 19:35:33 olegk Exp $ + * $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/params/HttpConnectionManagerParams.java,v 1.1 2003/10/22 19:35:33 olegk Exp $ * $Revision: 1.1 $ * $Date: 2003/10/22 19:35:33 $ * @@ -75,4 +75,52 @@ * @version $Revision: 1.1 $ */ public class HttpConnectionManagerParams extends HttpConnectionParams { + + /** + * Sets the timeout in milliseconds used when retrieving an + * {@link org.apache.commons.httpclient.HttpConnection HTTP connection} from the + * {@link org.apache.commons.httpclient.HttpConnectionManager HTTP connection manager}. + *+ * This parameter expects a value of type {@link Long}. + *
+ */ + public static final String CONNECTION_MANAGER_TIMEOUT = "http.connection-manager.timeout"; + + /** + * Defines the default maximum number of connections allowed per host. + *+ * This parameter expects a value of type {@link Integer}. + *
+ */ + public static final String MAX_HOST_CONNECTIONS = "http.connection-manager.max-per-host"; + + /** + * Defines the default maximum number of connections allowed overall. + *+ * This parameter expects a value of type {@link Integer}. + *
+ */ + public static final String MAX_TOTAL_CONNECTIONS = "http.connection-manager.max-total"; + /** + * Returns the timeout in milliseconds used when retrieving an + * {@link org.apache.commons.httpclient.HttpConnection HTTP connection} from the + * {@link org.apache.commons.httpclient.HttpConnectionManager HTTP connection manager}. + * + * @return timeout in milliseconds. + */ + public long getConnectionManagerTimeout() { + return getLongParameter(CONNECTION_MANAGER_TIMEOUT, 0); + } + + /** + * Sets the timeout in milliseconds used when retrieving an + * {@link org.apache.commons.httpclient.HttpConnection HTTP connection} from the + * {@link org.apache.commons.httpclient.HttpConnectionManager HTTP connection manager}. + * + * @param timeout the timeout in milliseconds + */ + public void setConnectionManagerTimeout(long timeout) { + setLongParameter(CONNECTION_MANAGER_TIMEOUT, timeout); + } + } Index: test/org/apache/commons/httpclient/TestHttpConnection.java =================================================================== RCS file: /home/cvspublic/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestHttpConnection.java,v retrieving revision 1.12 diff -u -r1.12 TestHttpConnection.java --- test/org/apache/commons/httpclient/TestHttpConnection.java 22 Oct 2003 19:31:00 -0000 1.12 +++ test/org/apache/commons/httpclient/TestHttpConnection.java 22 Oct 2003 20:47:12 -0000 @@ -129,7 +129,7 @@ connectionManager.setConnection(new HttpConnection(getHost(), getPort(), testProtocol)); HttpClient client = createHttpClient(connectionManager); client.getHostConfiguration().setHost(getHost(), getPort(), testProtocol); - client.getParams().setConnectionTimeout(1); + client.getHttpConnectionManager().getParams().setConnectionTimeout(1); try { GetMethod get = new GetMethod(); Index: test/org/apache/commons/httpclient/TestHttpConnectionManager.java =================================================================== RCS file: /home/cvspublic/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestHttpConnectionManager.java,v retrieving revision 1.11 diff -u -r1.11 TestHttpConnectionManager.java --- test/org/apache/commons/httpclient/TestHttpConnectionManager.java 3 Oct 2003 20:57:36 -0000 1.11 +++ test/org/apache/commons/httpclient/TestHttpConnectionManager.java 22 Oct 2003 20:47:15 -0000 @@ -1,5 +1,5 @@ /* - * $Header: /home/cvspublic/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestHttpConnectionManager.java,v 1.11 2003/10/03 20:57:36 olegk Exp $ + * $Header: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestHttpConnectionManager.java,v 1.11 2003/10/03 20:57:36 olegk Exp $ * $Revision: 1.11 $ * $Date: 2003/10/03 20:57:36 $ * ==================================================================== @@ -230,7 +230,7 @@ HttpClient client = createHttpClient(connectionManager); // we shouldn't have to wait if a connection is available - client.getParams().setConnectionManagerTimeout(1); + client.getHttpConnectionManager().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.getParams().setConnectionManagerTimeout( 1 ); + client.getHttpConnectionManager().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.getParams().setConnectionManagerTimeout( 1 ); + client.getHttpConnectionManager().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.getParams().setConnectionManagerTimeout( 30000 ); + client.getHttpConnectionManager().getParams().setConnectionManagerTimeout( 30000 ); GetMethod getMethod = new GetMethod("/");