public class GenericHttpInvoker extends Object implements HttpOperations, HttpClientConfig
HttpOperationsUTF_8| 构造器和说明 |
|---|
GenericHttpInvoker(HttpOperations httpOperations,
HttpClientConfig httpClientConfig) |
| 限定符和类型 | 方法和说明 |
|---|---|
<T> T |
exchange(String url,
HttpMethod method,
BodyType bodyType,
ResponseType responseType,
Type responseEntityType,
Map<String,String> httpHeaders,
Map<String,Object> uriVariables,
Object requestBody)
自定义执行http请求
|
static GenericHttpInvoker |
newInstance() |
static GenericHttpInvoker |
newInstance(int socketTimeout,
int connectTimeout)
new instance
|
static GenericHttpInvoker |
newInstance(String host,
int socketTimeout,
int connectTimeout)
new instance
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitexchange, exchange, getForEntity, getForEntity, getForEntity, getForJsonEntity, getForJsonEntity, postForEntity, postForEntity, postForEntity, postForJsonEntity, postForJsonEntityaddHeader, addInterceptor, addParameter, removeInterceptors, removeInterceptors, setBasicAuth, setCharset, setHost, setHttpClient, setProxy, setThreadPool, setTimeout, setUserAgentpublic GenericHttpInvoker(HttpOperations httpOperations, HttpClientConfig httpClientConfig)
public static GenericHttpInvoker newInstance()
public static GenericHttpInvoker newInstance(int socketTimeout, int connectTimeout)
socketTimeout - 设置套接字的超时时间(等待数据响应的超时时间),即两个数据包之间可以间隔的最大时间。如果为0则永不超时,如果为负值则使用系统设置,默认为-1connectTimeout - 设置建立连接所允许的超时时间。如果为0则永不超时,如果为负值则使用系统设置,默认为-1public static GenericHttpInvoker newInstance(String host, int socketTimeout, int connectTimeout)
host - hostsocketTimeout - 设置套接字的超时时间(等待数据响应的超时时间),即两个数据包之间可以间隔的最大时间。如果为0则永不超时,如果为负值则使用系统设置,默认为-1connectTimeout - 设置建立连接所允许的超时时间。如果为0则永不超时,如果为负值则使用系统设置,默认为-1public <T> T exchange(@Nonnull String url, @Nonnull HttpMethod method, @Nonnull BodyType bodyType, @Nonnull ResponseType responseType, @Nonnull Type responseEntityType, @Nullable Map<String,String> httpHeaders, @Nullable Map<String,Object> uriVariables, @Nullable Object requestBody)
HttpOperationsexchange 在接口中 HttpOperationsurl - 请求地址。如请求地址为https://example.com/foo/bar,则url应为/foo/barmethod - 请求方法。如GET, POST等bodyType - 请求body类型responseType - response body类型responseEntityType - 返回实体类型 TypeReferencehttpHeaders - 请求headeruriVariables - 查询参数requestBody - 请求bodyresponseEntityType指定的返回值Copyright © 2019. All rights reserved.