本文整理了Java中org.eclipse.jetty.client.HttpClient.setUserAgentField()
方法的一些代码示例,展示了HttpClient.setUserAgentField()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpClient.setUserAgentField()
方法的具体详情如下:
包路径:org.eclipse.jetty.client.HttpClient
类名称: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);
内容来源于网络,如有侵权,请联系作者删除!