Class HttpProvider

  • All Implemented Interfaces:
    Provider

    public class HttpProvider
    extends java.lang.Object
    implements Provider
    The HttpProvider class transports JSON-RPC payloads through HTTP.
    • Constructor Summary

      Constructors 
      Constructor Description
      HttpProvider​(java.lang.String url)
      Initializes a new HttpProvider with the given endpoint url.
      HttpProvider​(java.lang.String uri, int version)
      Initializes a new HttpProvider with the given server uri.
      HttpProvider​(okhttp3.OkHttpClient httpClient, java.lang.String url)
      Initializes a new HttpProvider with the custom http client object and the given endpoint url.
      HttpProvider​(okhttp3.OkHttpClient httpClient, java.lang.String uri, int version)
      Initializes a new HttpProvider 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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • HttpProvider

        public HttpProvider​(okhttp3.OkHttpClient httpClient,
                            java.lang.String url)
        Initializes a new HttpProvider with the custom http client object and the given endpoint url.
        Parameters:
        httpClient - a custom http client to send HTTP requests and read their responses
        url - an endpoint url, ex) http://localhost:9000/api/v3
      • HttpProvider

        public HttpProvider​(okhttp3.OkHttpClient httpClient,
                            java.lang.String uri,
                            int version)
        Initializes a new HttpProvider with the custom http client object and the given server uri.
        Parameters:
        httpClient - a custom http client to send HTTP requests and read their responses
        uri - 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 new HttpProvider 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 new HttpProvider 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