Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 46185 invoked from network); 22 Oct 2003 19:35:39 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 22 Oct 2003 19:35:39 -0000 Received: (qmail 11457 invoked by uid 500); 22 Oct 2003 19:35:24 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 11408 invoked by uid 500); 22 Oct 2003 19:35:24 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 11395 invoked by uid 500); 22 Oct 2003 19:35:24 -0000 Received: (qmail 11390 invoked from network); 22 Oct 2003 19:35:24 -0000 Received: from unknown (HELO minotaur.apache.org) (209.237.227.194) by daedalus.apache.org with SMTP; 22 Oct 2003 19:35:24 -0000 Received: (qmail 46149 invoked by uid 1624); 22 Oct 2003 19:35:34 -0000 Date: 22 Oct 2003 19:35:34 -0000 Message-ID: <20031022193534.46148.qmail@minotaur.apache.org> From: olegk@apache.org To: jakarta-commons-cvs@apache.org Subject: cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/params HttpConnectionManagerParams.java HttpConnectionParams.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N olegk 2003/10/22 12:35:34 Added: httpclient/src/java/org/apache/commons/httpclient/params HttpConnectionManagerParams.java HttpConnectionParams.java Log: PR #15435 (New Preferences Architecture) - HttpConnection & HttpConnectionManager classes updated to take advantage of the new preference architecute. Contributed by Oleg Kalnichevski Reviewed by Michael Becke Revision Changes Path 1.1 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/params/HttpConnectionManagerParams.java Index: HttpConnectionManagerParams.java =================================================================== /* * $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 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * * Copyright (c) 1999-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "The Jakarta Project", "Commons", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written * permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . * * [Additional notices, if required by prior licensing conditions] * */ package org.apache.commons.httpclient.params; /** * This class represents a collection of HTTP protocol parameters applicable to * {@link org.apache.commons.httpclient.HttpConnectionManager HTTP connection managers}. * Protocol parameters may be linked together to form a hierarchy. If a particular * parameter value has not been explicitly defined in the collection itself, its * value will be drawn from the parent collection of parameters. * * @author Oleg Kalnichevski * * @version $Revision: 1.1 $ */ public class HttpConnectionManagerParams extends HttpConnectionParams { } 1.1 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/params/HttpConnectionParams.java Index: HttpConnectionParams.java =================================================================== /* * $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/params/HttpConnectionParams.java,v 1.1 2003/10/22 19:35:33 olegk Exp $ * $Revision: 1.1 $ * $Date: 2003/10/22 19:35:33 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * * Copyright (c) 1999-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "The Jakarta Project", "Commons", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written * permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . * * [Additional notices, if required by prior licensing conditions] * */ package org.apache.commons.httpclient.params; /** * This class represents a collection of HTTP protocol parameters applicable to * {@link org.apache.commons.httpclient.HttpConnection HTTP connections}. * Protocol parameters may be linked together to form a hierarchy. If a particular * parameter value has not been explicitly defined in the collection itself, its * value will be drawn from the parent collection of parameters. * * @author Oleg Kalnichevski * * @version $Revision: 1.1 $ */ public class HttpConnectionParams extends DefaultHttpParams { /** * 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}. *

* @see java.net.SocketOptions#SO_TIMEOUT */ public static final String SO_TIMEOUT = "http.socket.timeout"; /** * Determines whether Nagle's algorithm is to be used. The Nagle's algorithm * tries to conserve bandwidth by minimizing the number of segments that are * sent. When applications wish to decrease network latency and increase * performance, they can disable Nagle's algorithm (that is enable TCP_NODELAY). * Data will be sent earlier, at the cost of an increase in bandwidth consumption. *

* This parameter expects a value of type {@link Boolean}. *

* @see java.net.SocketOptions#TCP_NODELAY */ public static final String TCP_NODELAY = "http.tcp.nodelay"; /** * Determines a hint the size of the underlying buffers used by the platform * for outgoing network I/O. This value is a suggestion to the kernel from * the application about the size of buffers to use for the data to be sent * over the socket. *

* This parameter expects a value of type {@link Integer}. *

* @see java.net.SocketOptions#SO_SNDBUF */ public static final String SO_SNDBUF = "http.socket.sendbuffer"; /** * Determines a hint the size of the underlying buffers used by the platform * for incoming network I/O. This value is a suggestion to the kernel from * the application about the size of buffers to use for the data to be received * over the socket. *

* This parameter expects a value of type {@link Integer}. *

* @see java.net.SocketOptions#SO_RCVBUF */ public static final String SO_RCVBUF = "http.socket.receivebuffer"; /** * Determines 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"; /** * Determines whether stale connection check is to be used. Disabling * stale connection check may result in slight performance improvement * at the risk of getting an I/O error when executing a request over a * connection that has been closed at the server side. *

* This parameter expects a value of type {@link Boolean}. *

*/ public static final String STALE_CONNECTION_CHECK = "http.connection.stalecheck"; /** * 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 * explicitly set in the collection itself. * * @see #getDefaultParams() */ public HttpConnectionParams() { super(); } /** * 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); } /** * Determines whether Nagle's algorithm is to be used. The Nagle's algorithm * tries to conserve bandwidth by minimizing the number of segments that are * sent. When applications wish to decrease network latency and increase * performance, they can disable Nagle's algorithm (that is enable TCP_NODELAY). * Data will be sent earlier, at the cost of an increase in bandwidth consumption. * * @param value true if the Nagle's algorithm is to NOT be used * (that is enable TCP_NODELAY), false otherwise. */ public void setTcpNoDelay(boolean value) { setBooleanParameter(TCP_NODELAY, value); } /** * Tests if Nagle's algorithm is to be used. * * @return true if the Nagle's algorithm is to NOT be used * (that is enable TCP_NODELAY), false otherwise. */ public boolean getTcpNoDelay() { return getBooleanParameter(TCP_NODELAY, true); } /** * Returns a hint the size of the underlying buffers used by the platform for * outgoing network I/O. This value is a suggestion to the kernel from the * application about the size of buffers to use for the data to be sent over * the socket. * * @return the hint size of the send buffer */ public int getSendBufferSize() { return getIntParameter(SO_SNDBUF, -1); } /** * Sets a hint the size of the underlying buffers used by the platform for * outgoing network I/O. This value is a suggestion to the kernel from the * application about the size of buffers to use for the data to be sent over * the socket. * * @param size the hint size of the send buffer */ public void setSendBufferSize(int size) { setIntParameter(SO_SNDBUF, size); } /** * Returns a hint the size of the underlying buffers used by the platform * for incoming network I/O. This value is a suggestion to the kernel from * the application about the size of buffers to use for the data to be received * over the socket. * * @return the hint size of the send buffer */ public int getReceiveBufferSize() { return getIntParameter(SO_RCVBUF, -1); } /** * Sets a hint the size of the underlying buffers used by the platform * for incoming network I/O. This value is a suggestion to the kernel from * the application about the size of buffers to use for the data to be received * over the socket. * * @param size the hint size of the send buffer */ public void setReceiveBufferSize(int size) { setIntParameter(SO_RCVBUF, size); } /** * 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); } /** * Tests whether stale connection check is to be used. Disabling * stale connection check may result in slight performance improvement * at the risk of getting an I/O error when executing a request over a * connection that has been closed at the server side. * * @return true if stale connection check is to be used, * false otherwise. */ public boolean isStaleCheckingEnabled() { return getBooleanParameter(STALE_CONNECTION_CHECK, true); } /** * Defines whether stale connection check is to be used. Disabling * stale connection check may result in slight performance improvement * at the risk of getting an I/O error when executing a request over a * connection that has been closed at the server side. * * @param value true if stale connection check is to be used, * false otherwise. */ public void setStaleCheckingEnabled(boolean value) { setBooleanParameter(STALE_CONNECTION_CHECK, value); } } --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org