FileDocCategorySizeDatePackage
HttpConnectionParams.javaAPI DocAndroid 1.5 API9057Wed May 06 22:41:10 BST 2009org.apache.http.params

HttpConnectionParams

public final class HttpConnectionParams extends Object implements CoreConnectionPNames
An adaptor for accessing connection parameters in {@link HttpParams}.
Note that the implements relation to {@link CoreConnectionPNames} is for compatibility with existing application code only. References to the parameter names should use the interface, not this class.
author
Oleg Kalnichevski
version
$Revision: 576089 $
since
4.0

Fields Summary
Constructors Summary
private HttpConnectionParams()

        super();
    
Methods Summary
public static intgetConnectionTimeout(org.apache.http.params.HttpParams params)
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.

        if (params == null) {
            throw new IllegalArgumentException("HTTP parameters may not be null");
        }
        return params.getIntParameter
            (CoreConnectionPNames.CONNECTION_TIMEOUT, 0);
    
public static intgetLinger(org.apache.http.params.HttpParams params)
Returns linger-on-close timeout. Value 0 implies that the option is disabled. Value -1 implies that the JRE default is used.

return
the linger-on-close timeout

        if (params == null) {
            throw new IllegalArgumentException("HTTP parameters may not be null");
        }
        return params.getIntParameter(CoreConnectionPNames.SO_LINGER, -1);
    
public static intgetSoTimeout(org.apache.http.params.HttpParams params)
Returns the default 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 value is used when no socket timeout is set in the method parameters.

return
timeout in milliseconds

        if (params == null) {
            throw new IllegalArgumentException("HTTP parameters may not be null");
        }
        return params.getIntParameter(CoreConnectionPNames.SO_TIMEOUT, 0);
    
public static intgetSocketBufferSize(org.apache.http.params.HttpParams params)

        if (params == null) {
            throw new IllegalArgumentException("HTTP parameters may not be null");
        }
        return params.getIntParameter
            (CoreConnectionPNames.SOCKET_BUFFER_SIZE, -1);
    
public static booleangetTcpNoDelay(org.apache.http.params.HttpParams params)
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.

        if (params == null) {
            throw new IllegalArgumentException("HTTP parameters may not be null");
        }
        return params.getBooleanParameter
            (CoreConnectionPNames.TCP_NODELAY, true);
    
public static booleanisStaleCheckingEnabled(org.apache.http.params.HttpParams params)
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.

        if (params == null) {
            throw new IllegalArgumentException("HTTP parameters may not be null");
        }
        return params.getBooleanParameter
            (CoreConnectionPNames.STALE_CONNECTION_CHECK, true);
    
public static voidsetConnectionTimeout(org.apache.http.params.HttpParams params, int timeout)
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.

        if (params == null) {
            throw new IllegalArgumentException("HTTP parameters may not be null");
        }
        params.setIntParameter
            (CoreConnectionPNames.CONNECTION_TIMEOUT, timeout);
    
public static voidsetLinger(org.apache.http.params.HttpParams params, int value)
Returns linger-on-close timeout. This option disables/enables immediate return from a close() of a TCP Socket. Enabling this option with a non-zero Integer timeout means that a close() will block pending the transmission and acknowledgement of all data written to the peer, at which point the socket is closed gracefully. Value 0 implies that the option is disabled. Value -1 implies that the JRE default is used.

param
value the linger-on-close timeout

        if (params == null) {
            throw new IllegalArgumentException("HTTP parameters may not be null");
        }
        params.setIntParameter(CoreConnectionPNames.SO_LINGER, value);
    
public static voidsetSoTimeout(org.apache.http.params.HttpParams params, int timeout)
Sets the default 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 value is used when no socket timeout is set in the method parameters.

param
timeout Timeout in milliseconds

        if (params == null) {
            throw new IllegalArgumentException("HTTP parameters may not be null");
        }
        params.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, timeout);
        
    
public static voidsetSocketBufferSize(org.apache.http.params.HttpParams params, int size)

        if (params == null) {
            throw new IllegalArgumentException("HTTP parameters may not be null");
        }
        params.setIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, size);
    
public static voidsetStaleCheckingEnabled(org.apache.http.params.HttpParams params, boolean value)
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.

        if (params == null) {
            throw new IllegalArgumentException("HTTP parameters may not be null");
        }
        params.setBooleanParameter
            (CoreConnectionPNames.STALE_CONNECTION_CHECK, value);
    
public static voidsetTcpNoDelay(org.apache.http.params.HttpParams params, boolean value)
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.

        if (params == null) {
            throw new IllegalArgumentException("HTTP parameters may not be null");
        }
        params.setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, value);