Package org.apache.http.client.fluent

Examples of org.apache.http.client.fluent.Executor.execute()


      byte[] resultBytes = Request.Get(contentUrl).connectTimeout(TIMEOUT_SECONDS * 1000)
          .socketTimeout(TIMEOUT_SECONDS * 1000).execute().returnContent().asBytes();

      // demo3: 获取图片,使用之前设置好了的自定义连接池与超时的httpClient
      Executor executor = Executor.newInstance(httpClient);
      String resultString2 = executor.execute(Request.Get(contentUrl)).returnContent().asString();
    } catch (HttpResponseException e) {
      logger.error("Status code:" + e.getStatusCode(), e);
    }
  }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.