当前位置: 首页>>代码示例>>Java>>正文


Java HttpConnectionParams.setTcpNoDelay方法代码示例

本文整理汇总了Java中ch.boye.httpclientandroidlib.params.HttpConnectionParams.setTcpNoDelay方法的典型用法代码示例。如果您正苦于以下问题:Java HttpConnectionParams.setTcpNoDelay方法的具体用法?Java HttpConnectionParams.setTcpNoDelay怎么用?Java HttpConnectionParams.setTcpNoDelay使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ch.boye.httpclientandroidlib.params.HttpConnectionParams的用法示例。

在下文中一共展示了HttpConnectionParams.setTcpNoDelay方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createDefaultHttpParams

import ch.boye.httpclientandroidlib.params.HttpConnectionParams; //导入方法依赖的package包/类
/**
 * Creates default params setting the user agent.
 * 
 * @return Basic HTTP parameters with a custom user agent
 */
protected HttpParams createDefaultHttpParams() {
	HttpParams params = new BasicHttpParams();
	HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
	String version = Version.getSpecification();
	if (version == null) {
		version = VersionInfo.UNAVAILABLE;
	}
	HttpProtocolParams.setUserAgent(params, "Sardine/" + version);
	// Only selectively enable this for PUT but not all entity enclosing
	// methods
	HttpProtocolParams.setUseExpectContinue(params, false);
	HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
	HttpProtocolParams.setContentCharset(params,
			HTTP.DEFAULT_CONTENT_CHARSET);

	HttpConnectionParams.setTcpNoDelay(params, true);
	HttpConnectionParams.setSocketBufferSize(params, 8192);
	return params;
}
 
开发者ID:starn,项目名称:encdroidMC,代码行数:25,代码来源:SardineImpl.java


示例2: setDefaultHttpParams

import ch.boye.httpclientandroidlib.params.HttpConnectionParams; //导入方法依赖的package包/类
/**
 * Saves the default set of HttpParams in the provided parameter.
 * These are:
 * <ul>
 * <li>{@link ch.boye.httpclientandroidlib.params.CoreProtocolPNames#PROTOCOL_VERSION}:
 *   1.1</li>
 * <li>{@link ch.boye.httpclientandroidlib.params.CoreProtocolPNames#HTTP_CONTENT_CHARSET}:
 *   ISO-8859-1</li>
 * <li>{@link ch.boye.httpclientandroidlib.params.CoreConnectionPNames#TCP_NODELAY}:
 *   true</li>
 * <li>{@link ch.boye.httpclientandroidlib.params.CoreConnectionPNames#SOCKET_BUFFER_SIZE}:
 *   8192</li>
 * <li>{@link ch.boye.httpclientandroidlib.params.CoreProtocolPNames#USER_AGENT}:
 *   Apache-HttpClient/<release> (java 1.5)</li>
 * </ul>
 */
public static void setDefaultHttpParams(final HttpParams params) {
    HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
    HttpProtocolParams.setContentCharset(params, HTTP.DEF_CONTENT_CHARSET.name());
    HttpConnectionParams.setTcpNoDelay(params, true);
    HttpConnectionParams.setSocketBufferSize(params, 8192);
    HttpProtocolParams.setUserAgent(params, HttpClientBuilder.DEFAULT_USER_AGENT);
}
 
开发者ID:mozilla-mobile,项目名称:FirefoxData-android,代码行数:24,代码来源:DefaultHttpClient.java



注:本文中的ch.boye.httpclientandroidlib.params.HttpConnectionParams.setTcpNoDelay方法示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。