Class HttpService

  • All Implemented Interfaces:
    Web3jService

    public class HttpService
    extends Service
    HTTP implementation of our services API.
    • Constructor Summary

      Constructors 
      Constructor Description
      HttpService()  
      HttpService​(boolean includeRawResponse)  
      HttpService​(java.lang.String url)  
      HttpService​(java.lang.String url, boolean includeRawResponse)  
      HttpService​(java.lang.String url, okhttp3.OkHttpClient httpClient)  
      HttpService​(java.lang.String url, okhttp3.OkHttpClient httpClient, boolean includeRawResponses)  
      HttpService​(okhttp3.OkHttpClient httpClient)  
      HttpService​(okhttp3.OkHttpClient httpClient, boolean includeRawResponses)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addHeader​(java.lang.String key, java.lang.String value)  
      void addHeaders​(java.util.Map<java.lang.String,​java.lang.String> headersToAdd)  
      void close()
      Closes resources used by the service.
      java.util.HashMap<java.lang.String,​java.lang.String> getHeaders()  
      java.lang.String getUrl()  
      protected java.io.InputStream performIO​(java.lang.String request)  
      protected void processHeaders​(okhttp3.Headers headers)  
      • Methods inherited from class java.lang.Object

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

      • JSON_MEDIA_TYPE

        public static final okhttp3.MediaType JSON_MEDIA_TYPE
    • Constructor Detail

      • HttpService

        public HttpService​(java.lang.String url,
                           okhttp3.OkHttpClient httpClient,
                           boolean includeRawResponses)
      • HttpService

        public HttpService​(okhttp3.OkHttpClient httpClient,
                           boolean includeRawResponses)
      • HttpService

        public HttpService​(java.lang.String url,
                           okhttp3.OkHttpClient httpClient)
      • HttpService

        public HttpService​(java.lang.String url)
      • HttpService

        public HttpService​(java.lang.String url,
                           boolean includeRawResponse)
      • HttpService

        public HttpService​(okhttp3.OkHttpClient httpClient)
      • HttpService

        public HttpService​(boolean includeRawResponse)
      • HttpService

        public HttpService()
    • Method Detail

      • performIO

        protected java.io.InputStream performIO​(java.lang.String request)
                                         throws java.io.IOException
        Specified by:
        performIO in class Service
        Throws:
        java.io.IOException
      • processHeaders

        protected void processHeaders​(okhttp3.Headers headers)
      • addHeader

        public void addHeader​(java.lang.String key,
                              java.lang.String value)
      • addHeaders

        public void addHeaders​(java.util.Map<java.lang.String,​java.lang.String> headersToAdd)
      • getHeaders

        public java.util.HashMap<java.lang.String,​java.lang.String> getHeaders()
      • getUrl

        public java.lang.String getUrl()
      • close

        public void close()
                   throws java.io.IOException
        Description copied from interface: Web3jService
        Closes resources used by the service.
        Throws:
        java.io.IOException - thrown if a service failed to close all resources