类 NacosAsyncRestTemplate
- 作者:
- mai.jh
- 另请参阅:
AsyncHttpClientRequest,HttpClientResponse
-
字段概要
从类继承的字段 com.alibaba.nacos.common.http.client.AbstractNacosRestTemplate
logger -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明voidclose()close request client.<T> voidasync http delete URL request params are expanded using the given queryQuery,<T> voidasync http delete large request, when the parameter exceeds the URL limit, you can use this method to put the parameter into the body pass.<T> voidasync http get URL request params are expanded using the given queryQuery.<T> voidgetLarge(String url, Header header, Query query, Object body, Type responseType, Callback<T> callback)async get request, may be pulling a lot of data URL request params are expanded using the given queryQuery, More request parameters can be set via body.<T> voidasync http post Create a new resource by POSTing the given object to the http request.<T> voidpostForm(String url, Header header, Query query, Map<String,String> bodyValues, Type responseType, Callback<T> callback)async http post from Create a new resource by PUTting the given mapbodyValuesto http request, http header contentType default 'application/x-www-form-urlencoded;charset=utf-8'.<T> voidpostForm(String url, Header header, Map<String,String> bodyValues, Type responseType, Callback<T> callback)async http post from Create a new resource by PUTting the given mapbodyValuesto http request, http header contentType default 'application/x-www-form-urlencoded;charset=utf-8'.<T> voidpostJson(String url, Header header, Query query, String body, Type responseType, Callback<T> callback)async http post Json Create a new resource by POSTing the given object to the http request, http header contentType default 'application/json;charset=UTF-8'.<T> voidasync http post Json Create a new resource by POSTing the given object to the http request, http header contentType default 'application/json;charset=UTF-8'.<T> voidasync http put Create a new resource by PUTting the given body to http request.<T> voidputForm(String url, Header header, Query query, Map<String,String> bodyValues, Type responseType, Callback<T> callback)async http put from Create a new resource by PUTting the given mapbodyValuesto http request, http header contentType default 'application/x-www-form-urlencoded;charset=utf-8'.<T> voidputForm(String url, Header header, Map<String,String> bodyValues, Type responseType, Callback<T> callback)async http put from Create a new resource by PUTting the given mapbodyValuesto http request, http header contentType default 'application/x-www-form-urlencoded;charset=utf-8'.<T> voidputJson(String url, Header header, Query query, String body, Type responseType, Callback<T> callback)async http put Json Create a new resource by PUTting the given body to http request, http header contentType default 'application/json;charset=UTF-8'.<T> voidasync http put Json Create a new resource by PUTting the given body to http request, http header contentType default 'application/json;charset=UTF-8'.从类继承的方法 com.alibaba.nacos.common.http.client.AbstractNacosRestTemplate
registerResponseHandler, selectResponseHandler
-
构造器详细资料
-
NacosAsyncRestTemplate
-
-
方法详细资料
-
get
public <T> void get(String url, Header header, Query query, Type responseType, Callback<T> callback)async http get URL request params are expanded using the given queryQuery.responseTypecan be an RestResult or RestResult dataTtype.callbackResult callback execution, if you need response headers, you can convert the received RestResult to HttpRestResult.- 参数:
url- urlresponseType- return typeheader- http header paramquery- http query paramcallback- callbackCallback.onReceive(com.alibaba.nacos.common.model.RestResult)
-
getLarge
public <T> void getLarge(String url, Header header, Query query, Object body, Type responseType, Callback<T> callback)async get request, may be pulling a lot of data URL request params are expanded using the given queryQuery, More request parameters can be set via body.responseTypecan be an RestResult or RestResult dataTtype.callbackResult callback execution, if you need response headers, you can convert the received RestResult to HttpRestResult.- 参数:
url- urlheader- http header paramquery- http query parambody- get with bodyresponseType- return typecallback- callbackCallback.onReceive(com.alibaba.nacos.common.model.RestResult)
-
delete
public <T> void delete(String url, Header header, Query query, Type responseType, Callback<T> callback)async http delete URL request params are expanded using the given queryQuery,responseTypecan be an RestResult or RestResult dataTtypecallbackResult callback execution, if you need response headers, you can convert the received RestResult to HttpRestResult.- 参数:
url- urlheader- http header paramquery- http query paramresponseType- return typecallback- callbackCallback.onReceive(com.alibaba.nacos.common.model.RestResult)
-
delete
public <T> void delete(String url, Header header, String body, Type responseType, Callback<T> callback)async http delete large request, when the parameter exceeds the URL limit, you can use this method to put the parameter into the body pass.responseTypecan be an RestResult or RestResult dataTtypecallbackResult callback execution, if you need response headers, you can convert the received RestResult to HttpRestResult.- 参数:
url- urlheader- http header parambody- bodyresponseType- return typecallback- callbackCallback.onReceive(com.alibaba.nacos.common.model.RestResult)
-
put
public <T> void put(String url, Header header, Query query, Object body, Type responseType, Callback<T> callback)async http put Create a new resource by PUTting the given body to http request.URL request params are expanded using the given query
Query.responseTypecan be an RestResult or RestResult dataTtypecallbackResult callback execution, if you need response headers, you can convert the received RestResult to HttpRestResult.- 参数:
url- urlheader- http header paramquery- http query parambody- http body paramresponseType- return typecallback- callbackCallback.onReceive(com.alibaba.nacos.common.model.RestResult)
-
putJson
public <T> void putJson(String url, Header header, Query query, String body, Type responseType, Callback<T> callback)async http put Json Create a new resource by PUTting the given body to http request, http header contentType default 'application/json;charset=UTF-8'.URL request params are expanded using the given query
Query.responseTypecan be an RestResult or RestResult dataTtypecallbackResult callback execution, if you need response headers, you can convert the received RestResult to HttpRestResult.- 参数:
url- urlheader- http header paramquery- http query parambody- http body paramresponseType- return typecallback- callbackCallback.onReceive(com.alibaba.nacos.common.model.RestResult)
-
putJson
public <T> void putJson(String url, Header header, String body, Type responseType, Callback<T> callback)async http put Json Create a new resource by PUTting the given body to http request, http header contentType default 'application/json;charset=UTF-8'.responseTypecan be an RestResult or RestResult dataTtypecallbackResult callback execution, if you need response headers, you can convert the received RestResult to HttpRestResult.- 参数:
url- urlheader- http header parambody- http body paramresponseType- return typecallback- callbackCallback.onReceive(com.alibaba.nacos.common.model.RestResult)
-
putForm
public <T> void putForm(String url, Header header, Query query, Map<String,String> bodyValues, Type responseType, Callback<T> callback)async http put from Create a new resource by PUTting the given mapbodyValuesto http request, http header contentType default 'application/x-www-form-urlencoded;charset=utf-8'.URL request params are expanded using the given query
Query.responseTypecan be an RestResult or RestResult dataTtype.callbackResult callback execution, if you need response headers, you can convert the received RestResult to HttpRestResult.- 参数:
url- urlheader- http header paramquery- http query parambodyValues- http body paramresponseType- return typecallback- callbackCallback.onReceive(com.alibaba.nacos.common.model.RestResult)
-
putForm
public <T> void putForm(String url, Header header, Map<String,String> bodyValues, Type responseType, Callback<T> callback)async http put from Create a new resource by PUTting the given mapbodyValuesto http request, http header contentType default 'application/x-www-form-urlencoded;charset=utf-8'.responseTypecan be an RestResult or RestResult dataTtype.callbackResult callback execution, if you need response headers, you can convert the received RestResult to HttpRestResult.- 参数:
url- urlheader- http header parambodyValues- http body paramresponseType- return typecallback- callbackCallback.onReceive(com.alibaba.nacos.common.model.RestResult)
-
post
public <T> void post(String url, Header header, Query query, Object body, Type responseType, Callback<T> callback)async http post Create a new resource by POSTing the given object to the http request.URL request params are expanded using the given query
Query.responseTypecan be an RestResult or RestResult dataTtype.callbackResult callback execution, if you need response headers, you can convert the received RestResult to HttpRestResult.- 参数:
url- urlheader- http header paramquery- http query parambody- http body paramresponseType- return typecallback- callbackCallback.onReceive(com.alibaba.nacos.common.model.RestResult)
-
postJson
public <T> void postJson(String url, Header header, Query query, String body, Type responseType, Callback<T> callback)async http post Json Create a new resource by POSTing the given object to the http request, http header contentType default 'application/json;charset=UTF-8'.URL request params are expanded using the given query
Query.responseTypecan be an RestResult or RestResult dataTtype.callbackResult callback execution, if you need response headers, you can convert the received RestResult to HttpRestResult.- 参数:
url- urlheader- http header paramquery- http query parambody- http body paramresponseType- return typecallback- callbackCallback.onReceive(com.alibaba.nacos.common.model.RestResult)
-
postJson
public <T> void postJson(String url, Header header, String body, Type responseType, Callback<T> callback)async http post Json Create a new resource by POSTing the given object to the http request, http header contentType default 'application/json;charset=UTF-8'.responseTypecan be an RestResult or RestResult dataTtype.callbackResult callback execution, if you need response headers, you can convert the received RestResult to HttpRestResult.- 参数:
url- urlheader- http header parambody- http body paramresponseType- return typecallback- callbackCallback.onReceive(com.alibaba.nacos.common.model.RestResult)
-
postForm
public <T> void postForm(String url, Header header, Query query, Map<String,String> bodyValues, Type responseType, Callback<T> callback)async http post from Create a new resource by PUTting the given mapbodyValuesto http request, http header contentType default 'application/x-www-form-urlencoded;charset=utf-8'.URL request params are expanded using the given query
Query.responseTypecan be an RestResult or RestResult dataTtype.callbackResult callback execution, if you need response headers, you can convert the received RestResult to HttpRestResult.- 参数:
url- urlheader- http header paramquery- http query parambodyValues- http body paramresponseType- return typecallback- callbackCallback.onReceive(com.alibaba.nacos.common.model.RestResult)
-
postForm
public <T> void postForm(String url, Header header, Map<String,String> bodyValues, Type responseType, Callback<T> callback)async http post from Create a new resource by PUTting the given mapbodyValuesto http request, http header contentType default 'application/x-www-form-urlencoded;charset=utf-8'.responseTypecan be an RestResult or RestResult dataTtype.callbackResult callback execution, if you need response headers, you can convert the received RestResult to HttpRestResult.- 参数:
url- urlheader- http header parambodyValues- http body paramresponseType- return typecallback- callbackCallback.onReceive(com.alibaba.nacos.common.model.RestResult)
-
close
close request client.- 抛出:
Exception
-