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


Java HttpMethodParams.setSoTimeout方法代码示例

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


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

示例1: fastFailPing

import org.apache.commons.httpclient.params.HttpMethodParams; //导入方法依赖的package包/类
/**
 * @return the http response code returned from the server. Response code 200 means success.
 */
public static int fastFailPing(AuthenticatedUrl url) throws IOException
{
    PingRequest pingRequest = null;
    try
    {
        HttpClient httpClient = getHttpClient(url);
        pingRequest = new PingRequest(url.getPath());
        HttpMethodParams params = pingRequest.getParams();
        params.setSoTimeout(PING_TIMEOUT);
        httpClient.executeMethod(pingRequest);
        return pingRequest.getStatusCode();
    }
    finally
    {
        if (pingRequest != null)
        {
            pingRequest.releaseConnection();
        }
    }
}
 
开发者ID:goldmansachs,项目名称:jrpip,代码行数:24,代码来源:FastServletProxyFactory.java

示例2: requestNewSession

import org.apache.commons.httpclient.params.HttpMethodParams; //导入方法依赖的package包/类
public static Cookie[] requestNewSession(AuthenticatedUrl url)
{
    CreateSessionRequest createSessionRequest = null;
    try
    {
        HttpClient httpClient = getHttpClient(url);
        createSessionRequest = new CreateSessionRequest(url.getPath());
        HttpMethodParams params = createSessionRequest.getParams();
        params.setSoTimeout(PING_TIMEOUT);
        httpClient.executeMethod(createSessionRequest);
        return httpClient.getState().getCookies();
    }
    catch (Exception e)
    {
        throw new RuntimeException("Failed to create session", e);
    }
    finally
    {
        if (createSessionRequest != null)
        {
            createSessionRequest.releaseConnection();
        }
    }
}
 
开发者ID:goldmansachs,项目名称:jrpip,代码行数:25,代码来源:FastServletProxyFactory.java

示例3: configureHttpMethod

import org.apache.commons.httpclient.params.HttpMethodParams; //导入方法依赖的package包/类
private void configureHttpMethod(boolean skipContentCache, CacheData cacheData, long onceTimeOut,
        HttpMethod httpMethod) {
    if (skipContentCache && null != cacheData) {
        if (null != cacheData.getLastModifiedHeader() && Constants.NULL != cacheData.getLastModifiedHeader()) {
            httpMethod.addRequestHeader(Constants.IF_MODIFIED_SINCE, cacheData.getLastModifiedHeader());
        }
        if (null != cacheData.getMd5() && Constants.NULL != cacheData.getMd5()) {
            httpMethod.addRequestHeader(Constants.CONTENT_MD5, cacheData.getMd5());
        }
    }

    httpMethod.addRequestHeader(Constants.ACCEPT_ENCODING, "gzip,deflate");

    // 设置HttpMethod的参数
    HttpMethodParams params = new HttpMethodParams();
    params.setSoTimeout((int) onceTimeOut);
    // ///////////////////////
    httpMethod.setParams(params);
    httpClient.getHostConfiguration().setHost(diamondConfigure.getDomainNameList().get(this.domainNamePos.get()),
        diamondConfigure.getPort());
}
 
开发者ID:lysu,项目名称:diamond,代码行数:22,代码来源:DefaultDiamondSubscriber.java

示例4: configureAckHttpMethod

import org.apache.commons.httpclient.params.HttpMethodParams; //导入方法依赖的package包/类
private void configureAckHttpMethod(HttpMethod httpMethod, long onceTimeOut) {
	// ����appName�Ϳͻ��˰汾
	if (null != this.appName) {
		httpMethod.addRequestHeader(Constants.APPNAME, this.appName);
	}
	httpMethod.addRequestHeader(Constants.CLIENT_VERSION_HEADER,
			Constants.CLIENT_VERSION);

	// ����HttpMethod�IJ���
	HttpMethodParams params = new HttpMethodParams();
	params.setSoTimeout((int) onceTimeOut);

	httpMethod.setParams(params);
	httpClient.getHostConfiguration().setHost(
			diamondConfigure.getDomainNameList().get(
					this.domainNamePos.get()), diamondConfigure.getPort());
}
 
开发者ID:weijiahao001,项目名称:tb_diamond,代码行数:18,代码来源:DefaultDiamondSubscriber.java

示例5: configureHttpMethod

import org.apache.commons.httpclient.params.HttpMethodParams; //导入方法依赖的package包/类
private void configureHttpMethod(boolean skipContentCache,
		CacheData cacheData, long onceTimeOut, HttpMethod httpMethod) {
	if (skipContentCache && null != cacheData) {
		if (null != cacheData.getLastModifiedHeader()
				&& Constants.NULL != cacheData.getLastModifiedHeader()) {
			httpMethod.addRequestHeader(Constants.IF_MODIFIED_SINCE,
					cacheData.getLastModifiedHeader());
		}
		if (null != cacheData.getMd5()
				&& Constants.NULL != cacheData.getMd5()) {
			httpMethod.addRequestHeader(Constants.CONTENT_MD5,
					cacheData.getMd5());
		}
	}
	// ����appName�Ϳͻ��˰汾
	if (null != this.appName) {
		httpMethod.addRequestHeader(Constants.APPNAME, this.appName);
	}
	httpMethod.addRequestHeader(Constants.CLIENT_VERSION_HEADER,
			Constants.CLIENT_VERSION);

	httpMethod.addRequestHeader(Constants.ACCEPT_ENCODING, "gzip,deflate");

	// ����HttpMethod�IJ���
	HttpMethodParams params = new HttpMethodParams();
	params.setSoTimeout((int) onceTimeOut);
	// ///////////////////////
	httpMethod.setParams(params);
	httpClient.getHostConfiguration().setHost(
			diamondConfigure.getDomainNameList().get(
					this.domainNamePos.get()), diamondConfigure.getPort());
}
 
开发者ID:weijiahao001,项目名称:tb_diamond,代码行数:33,代码来源:DefaultDiamondSubscriber.java


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