org.eclipse.jetty.client.HttpClient.setUserAgentField()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(3.0k)|赞(0)|评价(0)|浏览(173)

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

HttpClient.setUserAgentField介绍

暂无

代码示例

代码示例来源:origin: danielflower/app-runner

private HttpClient createClient() throws Exception {
  int selectors = Math.max(1, Runtime.getRuntime().availableProcessors() / 2);
  HttpClient client = new HttpClient(new HttpClientTransportOverHTTP(selectors), new SslContextFactory(true));
  client.setFollowRedirects(false);
  client.setCookieStore(new HttpCookieStore.Empty());
  client.setMaxConnectionsPerDestination(256);
  client.setAddressResolutionTimeout(15000);
  client.setConnectTimeout(15000);
  client.setIdleTimeout(idleTimeout);
  client.setUserAgentField(null);
  client.start();
  client.getContentDecoderFactories().clear();
  return client;
}

代码示例来源:origin: isucon/isucon5-qualify

private HttpClient client() {
 HttpField agent = new HttpField("User-Agent", config.agent);
 HttpClient httpClient = new HttpClient();
 httpClient.setFollowRedirects(false);
 httpClient.setMaxConnectionsPerDestination(MAX_CONNECTIONS_PER_DEST);
 httpClient.setMaxRequestsQueuedPerDestination(MAX_QUEUED_REQUESTS_PER_DEST);
 httpClient.setUserAgentField(agent);
 httpClient.setCookieStore(new HttpCookieStore.Empty());
 return httpClient;
}

代码示例来源:origin: io.digdag/digdag-standards

private HttpClient client()
{
  boolean insecure = params.get("insecure", boolean.class, false);
  HttpClient httpClient = new HttpClient(new SslContextFactory(insecure));
  configureProxy(httpClient);
  boolean followRedirects = params.get("follow_redirects", boolean.class, true);
  httpClient.setFollowRedirects(followRedirects);
  httpClient.setMaxRedirects(maxRedirects);
  httpClient.setUserAgentField(new HttpField(
      USER_AGENT, userAgent + ' ' + httpClient.getUserAgentField().getValue()));
  try {
    httpClient.start();
  }
  catch (Exception e) {
    throw new TaskExecutionException(e);
  }
  return httpClient;
}

代码示例来源:origin: isucon/isucon5-final

private HttpClient client() {
  HttpField agent = new HttpField("User-Agent", config.agent);
  // TODO: non-keepalived client connections
  HttpClient httpClient = new HttpClient();
  httpClient.setFollowRedirects(false);
  httpClient.setMaxConnectionsPerDestination(MAX_CONNECTIONS_PER_DEST);
  httpClient.setMaxRequestsQueuedPerDestination(MAX_QUEUED_REQUESTS_PER_DEST);
  httpClient.setUserAgentField(agent);
  httpClient.setCookieStore(new HttpCookieStore.Empty());
  return httpClient;
}

代码示例来源:origin: org.attribyte/attribyte-http

proxyConfig.getProxies().add(new HttpProxy(options.proxyHost, options.proxyPort));
this.httpClient.setUserAgentField(new HttpField(HttpHeader.USER_AGENT, options.userAgent));
this.httpClient.setRequestBufferSize(options.requestBufferSize);
this.httpClient.setResponseBufferSize(options.responseBufferSize);

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

httpClient.setUserAgentField(null);

代码示例来源:origin: com.proofpoint.platform/http-client

httpClient.setUserAgentField(null);

相关文章

HttpClient类方法