org.apache.http.client.fluent.Request.viaProxy()方法的使用及代码示例

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

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

Request.viaProxy介绍

暂无

代码示例

代码示例来源:origin: org.coursera/metrics-datadog

request.viaProxy(this.transport.proxy);

代码示例来源:origin: net.aequologica.neo/dagr-vebchar

String proxyIfNeeded = config.getProxyIfNeeded(this.uri.getHost());
if (proxyIfNeeded != null) {
  request = request.viaProxy(proxyIfNeeded);

代码示例来源:origin: net.aequologica.neo/dagr-vebchar

String proxyIfNeeded = config.getProxyIfNeeded(this.uri.getHost());
if (proxyIfNeeded != null) {
  request = request.viaProxy(proxyIfNeeded);

代码示例来源:origin: de.matrixweb.smaller/client-common

/**
 * @param host
 * @param port
 * @param proxyhost
 * @param proxyport
 * @param bytes
 * @return the response as {@link InputStream}
 * @throws ExecutionException
 */
public byte[] send(final String host, final String port,
  final String proxyhost, final String proxyport, final byte[] bytes)
  throws ExecutionException {
 try {
  final Request request = Request.Post("http://" + host + ":" + port)
    .socketTimeout(0).connectTimeout(0);
  if (proxyhost != null && proxyport != null) {
   request.viaProxy(new HttpHost(proxyhost, Integer.valueOf(proxyport)));
  }
  final HttpResponse response = request
    .addHeader(Version.HEADER, Version.getCurrentVersion().toString())
    .bodyByteArray(bytes).execute().returnResponse();
  return handleResponse(response);
 } catch (final Exception e) {
  if (e instanceof SmallerException) {
   throw (SmallerException) e;
  }
  throw new ExecutionException("Failed to send zip file", e);
 }
}

代码示例来源:origin: reenWYJ/aude-distributed-spider-framework

/**
   * 下载网页
   *
   * @param url
   * @return
   * @throws ClientProtocolException
   * @throws IOException
   */
  public String downloader(String url) throws ClientProtocolException, IOException {
    String res = "";
    Request request = Request.Get(url).connectTimeout(this.timeout);
    if (this.agent != null) {
      request = request.userAgent(this.agent);
    }
    if (this.cookie != null) {
      request = request.addHeader("Cookie", this.cookie);
    }
    if (this.proxy != null) {
      request = request.viaProxy(this.proxy);
    }
    res = request.execute().returnContent().asString();
    return res;
  }
}

代码示例来源:origin: denger/sendcloud4j

private String requestSend(String uri, Email email) throws IOException {
  Request request = Request.Post(uri)
      .connectTimeout(connectTimeout)
      .socketTimeout(socketTimeout);
  if (proxy != null) {
    request.viaProxy(proxy);
  }
  if (email.hasAttachment()) {
    request.body(getMultipartEmailHttpEntity(email));
  } else {
    request.bodyForm(convertFrom(email.getParameters()).build(), UTF_8);
  }
  return request.execute().returnContent().asString(UTF_8);
}

代码示例来源:origin: denger/sendcloud4j

private String requestSend(String uri, Email email) throws IOException {
  Request request = Request.Post(uri)
      .connectTimeout(connectTimeout)
      .socketTimeout(socketTimeout);
  if (proxy != null) {
    request.viaProxy(proxy);
  }
  if (email.hasAttachment()) {
    request.body(getMultipartEmailHttpEntity(email));
  } else {
    request.bodyForm(convertFrom(email.getParameters()).build(), UTF_8);
  }
  return request.execute().returnContent().asString(UTF_8);
}

相关文章