HttpConnectionParams

public final class HttpConnectionParams
extends Object implements CoreConnectionPNames

java.lang.Object
   ↳ org.apache.http.params.HttpConnectionParams


This class was deprecated in API level 22.
Please use URL.openConnection() instead. Please visit this webpage for further details.

An adaptor for accessing connection parameters in HttpParams.
Note that the implements relation to CoreConnectionPNames is for compatibility with existing application code only. References to the parameter names should use the interface, not this class.

Summary

Inherited constants

String CONNECTION_TIMEOUT

Determines the timeout until a connection is etablished.

String MAX_HEADER_COUNT

Determines the maximum HTTP header count allowed.

String MAX_LINE_LENGTH

Determines the maximum line length limit.

String SOCKET_BUFFER_SIZE

Determines the size of the internal socket buffer used to buffer data while receiving / transmitting HTTP messages.

String SO_LINGER

Sets SO_LINGER with the specified linger time in seconds.

String SO_TIMEOUT

Defines the default socket timeout (SO_TIMEOUT) in milliseconds which is the timeout for waiting for data.

String STALE_CONNECTION_CHECK

Determines whether stale connection check is to be used.

String TCP_NODELAY

Determines whether Nagle's algorithm is to be used.

Public methods

static int getConnectionTimeout(HttpParams params)

Returns the timeout until a connection is etablished.

static int getLinger(HttpParams params)

Returns linger-on-close timeout.

static int getSoTimeout(HttpParams params)

Returns the default socket timeout (SO_TIMEOUT) in milliseconds which is the timeout for waiting for data.

static int getSocketBufferSize(HttpParams params)
static boolean getTcpNoDelay(HttpParams params)

Tests if Nagle's algorithm is to be used.

static boolean isStaleCheckingEnabled(HttpParams params)

Tests whether stale connection check is to be used.

static void setConnectionTimeout(HttpParams params, int timeout)

Sets the timeout until a connection is etablished.

static void setLinger(HttpParams params, int value)

Returns linger-on-close timeout.

static void setSoTimeout(HttpParams params, int timeout)

Sets the default socket timeout (SO_TIMEOUT) in milliseconds which is the timeout for waiting for data.

static void setSocketBufferSize(HttpParams params, int size)
static void setStaleCheckingEnabled(HttpParams params, boolean value)

Defines whether stale connection check is to be used.

static void setTcpNoDelay(HttpParams params, boolean value)

Determines whether Nagle's algorithm is to be used.

Inherited methods

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(long timeoutMillis, int nanos)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait(long timeoutMillis)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

Public methods

getConnectionTimeout

Added in API level 1
public static int getConnectionTimeout (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.

Parameters
params HttpParams

Returns
int timeout in milliseconds.

getLinger

Added in API level 1
public static int getLinger (HttpParams params)

Returns linger-on-close timeout. Value 0 implies that the option is disabled. Value -1 implies that the JRE default is used.

Parameters
params HttpParams

Returns
int the linger-on-close timeout

getSoTimeout

Added in API level 1
public static int getSoTimeout (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.

Parameters
params HttpParams

Returns
int timeout in milliseconds

getSocketBufferSize

Added in API level 1
public static int getSocketBufferSize (HttpParams params)

Parameters
params HttpParams

Returns
int

getTcpNoDelay

Added in API level 1
public static boolean getTcpNoDelay (HttpParams params)

Tests if Nagle's algorithm is to be used.

Parameters
params HttpParams

Returns
boolean true if the Nagle's algorithm is to NOT be used (that is enable TCP_NODELAY), false otherwise.

isStaleCheckingEnabled

Added in API level 1
public static boolean isStaleCheckingEnabled (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.

Parameters
params HttpParams

Returns
boolean true if stale connection check is to be used, false otherwise.

setConnectionTimeout

Added in API level 1
public static void setConnectionTimeout (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.

Parameters
params HttpParams

timeout int: Timeout in milliseconds.

setLinger

Added in API level 1
public static void setLinger (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.

Parameters
params HttpParams

value int: the linger-on-close timeout

setSoTimeout

Added in API level 1
public static void setSoTimeout (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.

Parameters
params HttpParams

timeout int: Timeout in milliseconds

setSocketBufferSize

Added in API level 1
public static void setSocketBufferSize (HttpParams params, 
                int size)

Parameters
params HttpParams

size int

setStaleCheckingEnabled

Added in API level 1
public static void setStaleCheckingEnabled (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.

Parameters
params HttpParams

value boolean: true if stale connection check is to be used, false otherwise.

setTcpNoDelay

Added in API level 1
public static void setTcpNoDelay (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.

Parameters
params HttpParams

value boolean: true if the Nagle's algorithm is to NOT be used (that is enable TCP_NODELAY), false otherwise.