public class NacosRestTemplate extends AbstractNacosRestTemplate
HttpClientRequest,
HttpClientResponselogger| 构造器和说明 |
|---|
NacosRestTemplate(org.slf4j.Logger logger,
HttpClientRequest requestClient) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
close()
close request client.
|
<T> HttpRestResult<T> |
delete(String url,
Header header,
Query query,
Type responseType)
http delete URL request params are expanded using the given query
Query. |
<T> HttpRestResult<T> |
delete(String url,
HttpClientConfig config,
Header header,
Query query,
Type responseType)
http delete URL request params are expanded using the given query
Query. |
<T> HttpRestResult<T> |
exchange(String url,
HttpClientConfig config,
Header header,
Query query,
Object body,
String httpMethod,
Type responseType)
Execute the HTTP method to the given URI template, writing the given request entity to the request, and returns
the response as
HttpRestResult. |
<T> HttpRestResult<T> |
exchangeForm(String url,
Header header,
Query query,
Map<String,String> bodyValues,
String httpMethod,
Type responseType)
Execute the HTTP method to the given URI template, writing the given request entity to the request, and returns
the response as
HttpRestResult. |
<T> HttpRestResult<T> |
get(String url,
Header header,
Query query,
Type responseType)
http get URL request params are expanded using the given query
Query. |
<T> HttpRestResult<T> |
get(String url,
HttpClientConfig config,
Header header,
Query query,
Type responseType)
http get URL request params are expanded using the given query
Query. |
List<HttpClientRequestInterceptor> |
getInterceptors()
Return the request interceptors that this accessor uses.
|
<T> HttpRestResult<T> |
getLarge(String url,
Header header,
Query query,
Object body,
Type responseType)
get request, may be pulling a lot of data URL request params are expanded using the given query
Query,
More request parameters can be set via body. |
<T> HttpRestResult<T> |
post(String url,
Header header,
Query query,
Object body,
Type responseType)
http post Create a new resource by POSTing the given object to the http request.
|
<T> HttpRestResult<T> |
postForm(String url,
Header header,
Map<String,String> bodyValues,
Type responseType)
http post from Create a new resource by PUTting the given map
bodyValues to http request, http header
contentType default 'application/x-www-form-urlencoded;charset=utf-8'. |
<T> HttpRestResult<T> |
postForm(String url,
Header header,
Query query,
Map<String,String> bodyValues,
Type responseType)
http post from Create a new resource by PUTting the given map
bodyValues to http request, http header
contentType default 'application/x-www-form-urlencoded;charset=utf-8'. |
<T> HttpRestResult<T> |
postForm(String url,
HttpClientConfig config,
Header header,
Map<String,String> bodyValues,
Type responseType)
http post from Create a new resource by PUTting the given map
bodyValues to http request, http header
contentType default 'application/x-www-form-urlencoded;charset=utf-8'. |
<T> HttpRestResult<T> |
postJson(String url,
Header header,
Query query,
String body,
Type responseType)
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> HttpRestResult<T> |
postJson(String url,
Header header,
String body,
Type responseType)
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> HttpRestResult<T> |
put(String url,
Header header,
Query query,
Object body,
Type responseType)
http put Create a new resource by PUTting the given body to http request.
|
<T> HttpRestResult<T> |
putForm(String url,
Header header,
Map<String,String> bodyValues,
Type responseType)
http put from Create a new resource by PUTting the given map
bodyValues to http request, http header
contentType default 'application/x-www-form-urlencoded;charset=utf-8'. |
<T> HttpRestResult<T> |
putForm(String url,
Header header,
Query query,
Map<String,String> bodyValues,
Type responseType)
http put from Create a new resource by PUTting the given map
bodyValues to http request, http header
contentType default 'application/x-www-form-urlencoded;charset=utf-8'. |
<T> HttpRestResult<T> |
putForm(String url,
HttpClientConfig config,
Header header,
Map<String,String> bodyValues,
Type responseType)
http put from Create a new resource by PUTting the given map
bodyValues to http request, http header
contentType default 'application/x-www-form-urlencoded;charset=utf-8'. |
<T> HttpRestResult<T> |
putJson(String url,
Header header,
Query query,
String body,
Type responseType)
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> HttpRestResult<T> |
putJson(String url,
Header header,
String body,
Type responseType)
http put json Create a new resource by PUTting the given body to http request, http header contentType default
'application/json;charset=UTF-8'.
|
void |
setInterceptors(List<HttpClientRequestInterceptor> interceptors)
Set the request interceptors that this accessor should use.
|
registerResponseHandler, selectResponseHandlerpublic NacosRestTemplate(org.slf4j.Logger logger,
HttpClientRequest requestClient)
public <T> HttpRestResult<T> get(String url, Header header, Query query, Type responseType) throws Exception
Query.
responseType can be an HttpRestResult or HttpRestResult data T type.
url - urlheader - http header paramquery - http query paramresponseType - return typeHttpRestResultException - expublic <T> HttpRestResult<T> get(String url, HttpClientConfig config, Header header, Query query, Type responseType) throws Exception
Query.
responseType can be an HttpRestResult or HttpRestResult data T type.
config Specify the request config via HttpClientConfig
url - urlconfig - http configheader - headersquery - http query paramresponseType - return typeHttpRestResultException - expublic <T> HttpRestResult<T> getLarge(String url, Header header, Query query, Object body, Type responseType) throws Exception
Query,
More request parameters can be set via body.
This method can only be used when HttpClientRequest is implemented by DefaultHttpClientRequest, note:
JdkHttpClientRequest Implementation does not support this method.
responseType can be an HttpRestResult or HttpRestResult data T type.
url - urlheader - http header paramquery - http query parambody - get with bodyresponseType - return typeHttpRestResultException - expublic <T> HttpRestResult<T> delete(String url, Header header, Query query, Type responseType) throws Exception
Query.
responseType can be an HttpRestResult or HttpRestResult data T type.
url - urlheader - http header paramquery - http query paramresponseType - return typeHttpRestResultException - expublic <T> HttpRestResult<T> delete(String url, HttpClientConfig config, Header header, Query query, Type responseType) throws Exception
Query.
responseType can be an HttpRestResult or HttpRestResult data T type.
config Specify the request config via HttpClientConfig
url - urlconfig - http configheader - http header paramquery - http query paramresponseType - return typeHttpRestResultException - expublic <T> HttpRestResult<T> put(String url, Header header, Query query, Object body, Type responseType) throws Exception
URL request params are expanded using the given query Query.
responseType can be an HttpRestResult or HttpRestResult data T type.
url - urlheader - http header paramquery - http query parambody - http body paramresponseType - return typeHttpRestResultException - expublic <T> HttpRestResult<T> putJson(String url, Header header, Query query, String body, Type responseType) throws Exception
URL request params are expanded using the given query Query.
responseType can be an HttpRestResult or HttpRestResult data T type.
url - urlheader - http header paramquery - http query parambody - http body paramresponseType - return typeHttpRestResultException - expublic <T> HttpRestResult<T> putJson(String url, Header header, String body, Type responseType) throws Exception
responseType can be an HttpRestResult or HttpRestResult data T type.
url - urlheader - http header parambody - http body paramresponseType - return typeHttpRestResultException - expublic <T> HttpRestResult<T> putForm(String url, Header header, Query query, Map<String,String> bodyValues, Type responseType) throws Exception
bodyValues to http request, http header
contentType default 'application/x-www-form-urlencoded;charset=utf-8'.
URL request params are expanded using the given query Query.
responseType can be an HttpRestResult or HttpRestResult data T type.
url - urlheader - http header paramquery - http query parambodyValues - http body paramresponseType - return typeHttpRestResultException - expublic <T> HttpRestResult<T> putForm(String url, Header header, Map<String,String> bodyValues, Type responseType) throws Exception
bodyValues to http request, http header
contentType default 'application/x-www-form-urlencoded;charset=utf-8'.
responseType can be an HttpRestResult or HttpRestResult data T type.
url - urlheader - http header parambodyValues - http body paramresponseType - return typeHttpRestResultException - expublic <T> HttpRestResult<T> putForm(String url, HttpClientConfig config, Header header, Map<String,String> bodyValues, Type responseType) throws Exception
bodyValues to http request, http header
contentType default 'application/x-www-form-urlencoded;charset=utf-8'.
responseType can be an HttpRestResult or HttpRestResult data T type.
config Specify the request config via HttpClientConfig
url - urlconfig - http configheader - http header parambodyValues - http body paramresponseType - return typeHttpRestResultException - expublic <T> HttpRestResult<T> post(String url, Header header, Query query, Object body, Type responseType) throws Exception
URL request params are expanded using the given query Query.
responseType can be an HttpRestResult or HttpRestResult data T type.
url - urlheader - http header paramquery - http query parambody - http body paramresponseType - return typeHttpRestResultException - expublic <T> HttpRestResult<T> postJson(String url, Header header, Query query, String body, Type responseType) throws Exception
URL request params are expanded using the given query Query.
responseType can be an HttpRestResult or HttpRestResult data T type.
url - urlheader - http header paramquery - http query parambody - http body paramresponseType - return typeHttpRestResultException - expublic <T> HttpRestResult<T> postJson(String url, Header header, String body, Type responseType) throws Exception
responseType can be an HttpRestResult or HttpRestResult data T type.
url - urlheader - http header parambody - http body paramresponseType - return typeHttpRestResultException - expublic <T> HttpRestResult<T> postForm(String url, Header header, Query query, Map<String,String> bodyValues, Type responseType) throws Exception
bodyValues to http request, http header
contentType default 'application/x-www-form-urlencoded;charset=utf-8'.
URL request params are expanded using the given query Query.
responseType can be an HttpRestResult or HttpRestResult data T type.
url - urlheader - http header paramquery - http query parambodyValues - http body paramresponseType - return typeHttpRestResultException - expublic <T> HttpRestResult<T> postForm(String url, Header header, Map<String,String> bodyValues, Type responseType) throws Exception
bodyValues to http request, http header
contentType default 'application/x-www-form-urlencoded;charset=utf-8'.
responseType can be an HttpRestResult or HttpRestResult data T type.
url - urlheader - http header parambodyValues - http body paramresponseType - return typeHttpRestResultException - expublic <T> HttpRestResult<T> postForm(String url, HttpClientConfig config, Header header, Map<String,String> bodyValues, Type responseType) throws Exception
bodyValues to http request, http header
contentType default 'application/x-www-form-urlencoded;charset=utf-8'.
responseType can be an HttpRestResult or HttpRestResult data T type.
config Specify the request config via HttpClientConfig
url - urlconfig - http configheader - http header parambodyValues - http body paramresponseType - return typeHttpRestResultException - expublic <T> HttpRestResult<T> exchangeForm(String url, Header header, Query query, Map<String,String> bodyValues, String httpMethod, Type responseType) throws Exception
HttpRestResult.url - urlheader - http header paramquery - http query parambodyValues - http body paramhttpMethod - http methodresponseType - return typeHttpRestResultException - expublic <T> HttpRestResult<T> exchange(String url, HttpClientConfig config, Header header, Query query, Object body, String httpMethod, Type responseType) throws Exception
HttpRestResult.url - urlconfig - HttpClientConfigheader - http header paramquery - http query parambody - http body paramhttpMethod - http methodresponseType - return typeHttpRestResultException - expublic void setInterceptors(List<HttpClientRequestInterceptor> interceptors)
interceptors - HttpClientRequestInterceptorpublic List<HttpClientRequestInterceptor> getInterceptors()
The returned List is active and may get appended to.
Copyright © 2018–2021 Alibaba Group. All rights reserved.