HttpConnectionParams

org.apache.http.params
类 HttpConnectionParams

java.lang.Object
  继承者 org.apache.http.params.HttpConnectionParams
所有已实现的接口:
CoreConnectionPNames

public final class HttpConnectionParams
    
    
     
     extends Object
    
    
    
    
     
     implements CoreConnectionPNames
    
    
 
 

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.

从以下版本开始:
4.0
版本:
$Revision: 576089 $
作者:
Oleg Kalnichevski

字段摘要
 
从接口 org.apache.http.params.CoreConnectionPNames 继承的字段
CONNECTION_TIMEOUT, MAX_HEADER_COUNT, MAX_LINE_LENGTH, SO_LINGER, SO_TIMEOUT, SOCKET_BUFFER_SIZE, STALE_CONNECTION_CHECK, TCP_NODELAY
 
方法摘要
static intgetConnectionTimeout(HttpParams params)           Returns the timeout until a connection is etablished.
static intgetLinger(HttpParams params)           Returns linger-on-close timeout.
static intgetSocketBufferSize(HttpParams params)            
static intgetSoTimeout(HttpParams params)           Returns the default socket timeout (SO_TIMEOUT) in milliseconds which is the timeout for waiting for data.
static booleangetTcpNoDelay(HttpParams params)           Tests if Nagle's algorithm is to be used.
static booleanisStaleCheckingEnabled(HttpParams params)           Tests whether stale connection check is to be used.
static voidsetConnectionTimeout(HttpParams params, int timeout)           Sets the timeout until a connection is etablished.
static voidsetLinger(HttpParams params, int value)           Returns linger-on-close timeout.
static voidsetSocketBufferSize(HttpParams params, int size)            
static voidsetSoTimeout(HttpParams params, int timeout)           Sets the default socket timeout (SO_TIMEOUT) in milliseconds which is the timeout for waiting for data.
static voidsetStaleCheckingEnabled(HttpParams params, boolean value)           Defines whether stale connection check is to be used.
static voidsetTcpNoDelay(HttpParams params, boolean value)           Determines whether Nagle's algorithm is to be used.
 
从类 java.lang.Object 继承的方法
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

方法详细信息

getSoTimeout

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.

返回:
timeout in milliseconds

setSoTimeout

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.

参数:
timeout - Timeout in milliseconds

getTcpNoDelay

public static boolean getTcpNoDelay(HttpParams params)
Tests if Nagle's algorithm is to be used.

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

setTcpNoDelay

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.

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

getSocketBufferSize

public static int getSocketBufferSize(HttpParams params)

setSocketBufferSize

public static void setSocketBufferSize(HttpParams params,
                                       int size)

getLinger

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.

返回:
the linger-on-close timeout

setLinger

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.

参数:
value - the linger-on-close timeout

getConnectionTimeout

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.

返回:
timeout in milliseconds.

setConnectionTimeout

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.

参数:
timeout - Timeout in milliseconds.

isStaleCheckingEnabled

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.

返回:
true if stale connection check is to be used, false otherwise.

setStaleCheckingEnabled

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 aconnection that has been closed at the server side.

参数:
value - true if stale connection check is to be used, false otherwise.
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值