當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。