Class HttpProvider
- java.lang.Object
-
- foundation.icon.icx.transport.http.HttpProvider
-
-
Constructor Summary
Constructors Constructor Description HttpProvider(java.lang.String url)
Initializes a newHttpProvider
with the given endpoint url.HttpProvider(java.lang.String uri, int version)
Initializes a newHttpProvider
with the given server uri.HttpProvider(okhttp3.OkHttpClient httpClient, java.lang.String url)
Initializes a newHttpProvider
with the custom http client object and the given endpoint url.HttpProvider(okhttp3.OkHttpClient httpClient, java.lang.String uri, int version)
Initializes a newHttpProvider
with the custom http client object and the given server uri.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Request<T>
request(Request request, RpcConverter<T> converter)
Prepares to execute the request
-
-
-
Constructor Detail
-
HttpProvider
public HttpProvider(okhttp3.OkHttpClient httpClient, java.lang.String url)
Initializes a newHttpProvider
with the custom http client object and the given endpoint url.- Parameters:
httpClient
- a custom http client to send HTTP requests and read their responsesurl
- an endpoint url, ex)http://localhost:9000/api/v3
-
HttpProvider
public HttpProvider(okhttp3.OkHttpClient httpClient, java.lang.String uri, int version)
Initializes a newHttpProvider
with the custom http client object and the given server uri.- Parameters:
httpClient
- a custom http client to send HTTP requests and read their responsesuri
- a server-based authority URI format, ex)<scheme>://<host>[:port]
version
- the version of JSON-RPC APIs- Since:
- 0.9.12
-
HttpProvider
public HttpProvider(java.lang.String url)
Initializes a newHttpProvider
with the given endpoint url. This will use a default http client object for the operation.- Parameters:
url
- an endpoint url, ex)http://localhost:9000/api/v3
-
HttpProvider
public HttpProvider(java.lang.String uri, int version)
Initializes a newHttpProvider
with the given server uri. This will use a default http client object for the operation.- Parameters:
uri
- a server-based authority URI format, ex)<scheme>://<host>[:port]
version
- the version of JSON-RPC APIs- Since:
- 0.9.12
-
-
Method Detail
-
request
public <T> Request<T> request(Request request, RpcConverter<T> converter)
Description copied from interface:Provider
Prepares to execute the request- Specified by:
request
in interfaceProvider
- Type Parameters:
T
- the return type- Parameters:
request
- the request to sendconverter
- the converter for the response data- Returns:
- a
Request
object to be executed - See Also:
Provider.request(foundation.icon.icx.transport.jsonrpc.Request, RpcConverter)
-
-