org.apache.commons.httpclient.HttpClient.setParams()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(3.9k)|赞(0)|评价(0)|浏览(293)

本文整理了Java中org.apache.commons.httpclient.HttpClient.setParams()方法的一些代码示例,展示了HttpClient.setParams()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpClient.setParams()方法的具体详情如下:
包路径:org.apache.commons.httpclient.HttpClient
类名称:HttpClient
方法名:setParams

HttpClient.setParams介绍

[英]Assigns HttpClientParams for this HttpClient.
[中]为此HttpClient分配HttpClientParams。

代码示例

代码示例来源:origin: apache/cloudstack

private HttpClient getHttpClient() {
  if (s_client == null) {
    final MultiThreadedHttpConnectionManager mgr = new MultiThreadedHttpConnectionManager();
    mgr.getParams().setDefaultMaxConnectionsPerHost(4);
    // TODO make it configurable
    mgr.getParams().setMaxTotalConnections(1000);
    s_client = new HttpClient(mgr);
    final HttpClientParams clientParams = new HttpClientParams();
    clientParams.setSoTimeout(ClusterServiceAdapter.ClusterMessageTimeOut.value() * 1000);
    s_client.setParams(clientParams);
  }
  return s_client;
}

代码示例来源:origin: tracee/tracee

@Override
  public void setParams(HttpClientParams params) {
    delegate.setParams(params);
  }
}

代码示例来源:origin: mozilla/zest

public void setParams(HttpClientParams params) {
  httpclient.setParams(params);
}

代码示例来源:origin: net.sourceforge/akismet-java

httpClientParams.setParameter(USER_AGENT_HEADER, USER_AGENT_VALUE);
httpClientParams.setParameter(HttpClientParams.RETRY_HANDLER, defaultHttpMethodRetryHandler);
httpClient.setParams(httpClientParams);

代码示例来源:origin: net.sf.delicious-java/delicious

/**
 * Create an object to interact with del.icio.us
 *
 * @param username    del.icio.us username
 * @param password    del.icio.us password
 * @param apiEndpoint del.icio.us API endpoint
 */
public Delicious(String username, String password, String apiEndpoint) {
  this.apiEndpoint = apiEndpoint;
  httpClient = new HttpClient();
  HttpClientParams httpClientParams = new HttpClientParams();
  DefaultHttpMethodRetryHandler defaultHttpMethodRetryHandler = new DefaultHttpMethodRetryHandler(0, false);
  httpClientParams.setParameter(DeliciousConstants.USER_AGENT_HEADER, DeliciousConstants.USER_AGENT_VALUE);
  httpClientParams.setParameter(HttpClientParams.RETRY_HANDLER, defaultHttpMethodRetryHandler);
  httpClient.setParams(httpClientParams);
  httpClient.getState().setCredentials(AuthScope.ANY,
      new UsernamePasswordCredentials(username, password));
  DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
  documentBuilderFactory.setValidating(false);
  documentBuilderFactory.setIgnoringElementContentWhitespace(true);
  documentBuilderFactory.setIgnoringComments(true);
  documentBuilderFactory.setCoalescing(true);
  documentBuilderFactory.setNamespaceAware(false);
  try {
    documentBuilder = documentBuilderFactory.newDocumentBuilder();
  } catch (ParserConfigurationException e) {
    logger.error(e);
  }
}

代码示例来源:origin: medcl/elasticsearch-river-email

httpClient.setParams(params);
try {
  httpClient.executeMethod(postMethod);

代码示例来源:origin: MissionCriticalCloud/cosmic

private HttpClient getHttpClient() {
  if (s_client == null) {
    final MultiThreadedHttpConnectionManager mgr = new MultiThreadedHttpConnectionManager();
    mgr.getParams().setDefaultMaxConnectionsPerHost(4);
    // TODO make it configurable
    mgr.getParams().setMaxTotalConnections(1000);
    s_client = new HttpClient(mgr);
    final HttpClientParams clientParams = new HttpClientParams();
    clientParams.setSoTimeout(ClusterServiceAdapter.ClusterMessageTimeOut.value() * 1000);
    s_client.setParams(clientParams);
  }
  return s_client;
}

代码示例来源:origin: org.codehaus.xfire/xfire-core

client.setParams(params);

代码示例来源:origin: com.github.abashev/commons-vfs2

final HttpClientParams httpClientParams = new HttpClientParams();
httpClientParams.setAuthenticationPreemptive(true);
client.setParams(httpClientParams);

代码示例来源:origin: org.apache.commons/commons-vfs2

final HttpClientParams httpClientParams = new HttpClientParams();
httpClientParams.setAuthenticationPreemptive(true);
client.setParams(httpClientParams);

代码示例来源:origin: apache/commons-vfs

final HttpClientParams httpClientParams = new HttpClientParams();
httpClientParams.setAuthenticationPreemptive(true);
client.setParams(httpClientParams);

相关文章