com.taosdata.jdbc.rs.util

## 类 HttpClientPoolUtil

- java.lang.Object
- - com.taosdata.jdbc.rs.util.HttpClientPoolUtil

    public class HttpClientPoolUtil
    extends Object

### 字段概要

字段
`static org.apache.http.impl.conn.PoolingHttpClientConnectionManager` `cm`
`static org.apache.http.conn.ConnectionKeepAliveStrategy` `defaultStrategy` Http connection keepAlive 设置
`static org.apache.http.impl.client.CloseableHttpClient` `httpClient`
`static String` `token`

### 构造器概要

构造器
构造器和说明
`HttpClientPoolUtil()`

### 方法概要

所有方法 静态方法 具体方法
`static String` `execute(String uri)` 执行GET 请求
`static String` `execute(String uri, String data)` 执行http post请求 默认采用Content-Type：application/json，Accept：application/json
`static org.apache.http.impl.client.CloseableHttpClient` `getHttpClient()`
`static org.apache.http.impl.conn.PoolingHttpClientConnectionManager` `getHttpConnectionManager()`
`static org.apache.http.client.methods.HttpRequestBase` `getRequest(String uri, String methodName, String contentType, int timeout)` * 创建请求
`static void` `initPools()` 初始化连接池

### 从类继承的方法 java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### 字段详细资料

#### cm

    public static org.apache.http.impl.conn.PoolingHttpClientConnectionManager cm

#### httpClient

    public static org.apache.http.impl.client.CloseableHttpClient httpClient

#### token

    public static String token

#### defaultStrategy

    public static org.apache.http.conn.ConnectionKeepAliveStrategy defaultStrategy

Http connection keepAlive 设置

### 构造器详细资料

#### HttpClientPoolUtil

    public HttpClientPoolUtil()

### 方法详细资料

#### initPools

    public static void initPools()

初始化连接池

#### getHttpClient

    public static org.apache.http.impl.client.CloseableHttpClient getHttpClient()

#### getHttpConnectionManager

    public static org.apache.http.impl.conn.PoolingHttpClientConnectionManager getHttpConnectionManager()

#### execute

    public static String execute(String uri,
                                 String data)

执行http post请求 默认采用Content-Type：application/json，Accept：application/json

参数:
  `uri` - 请求地址
  `data` - 请求数据
返回:
  responseBody

#### getRequest

    public static org.apache.http.client.methods.HttpRequestBase getRequest(String uri,
                                                                            String methodName,
                                                                            String contentType,
                                                                            int timeout)

* 创建请求

参数:
  `uri` - 请求url
  `methodName` - 请求的方法类型
  `contentType` - contentType类型
  `timeout` - 超时时间
返回:
  HttpRequestBase 返回类型

#### execute

    public static String execute(String uri)

执行GET 请求

参数:
  `uri` - 网址
返回:
  responseBody