Package org.web3j.protocol.http
Class HttpService
- java.lang.Object
-
- org.web3j.protocol.Service
-
- org.web3j.protocol.http.HttpService
-
- All Implemented Interfaces:
Web3jService
public class HttpService extends Service
HTTP implementation of our services API.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_URLstatic okhttp3.MediaTypeJSON_MEDIA_TYPE-
Fields inherited from class org.web3j.protocol.Service
objectMapper
-
-
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 voidaddHeader(java.lang.String key, java.lang.String value)voidaddHeaders(java.util.Map<java.lang.String,java.lang.String> headersToAdd)voidclose()Closes resources used by the service.java.util.HashMap<java.lang.String,java.lang.String>getHeaders()java.lang.StringgetUrl()protected java.io.InputStreamperformIO(java.lang.String request)protected voidprocessHeaders(okhttp3.Headers headers)
-
-
-
Field Detail
-
JSON_MEDIA_TYPE
public static final okhttp3.MediaType JSON_MEDIA_TYPE
-
DEFAULT_URL
public static final java.lang.String DEFAULT_URL
- See Also:
- Constant Field Values
-
-
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
-
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.IOExceptionDescription copied from interface:Web3jServiceCloses resources used by the service.- Throws:
java.io.IOException- thrown if a service failed to close all resources
-
-