public class OkHttpServiceModule extends java.lang.Object implements HttpServiceModule
| Constructor and Description |
|---|
OkHttpServiceModule()
This is the default no argument constructor for all ServiceModules.
|
OkHttpServiceModule(okhttp3.OkHttpClient client)
This constructer uses a specific client for manual configurations and testing.
|
OkHttpServiceModule(okhttp3.OkHttpClient client,
ServiceConfiguration serviceConfiguration) |
| Modifier and Type | Method and Description |
|---|---|
void |
configure(MobileCore core,
ServiceConfiguration serviceConfiguration)
A method how create/configure the singleThreadService
|
void |
destroy()
Called when singleThreadService destroyed
|
HttpRequest |
newRequest()
Creates a new HttpRequest and prepends common configuration such as certificate pinning, user
agent headers, etc.
|
boolean |
requiresConfiguration()
Whether the singleThreadService module requires its singleThreadService configuration to be
defined or if it can be null.
|
java.lang.String |
type()
Type/name used in the mobile-singleThreadService.json
|
public OkHttpServiceModule()
public OkHttpServiceModule(okhttp3.OkHttpClient client)
client - a default OkHttpClient instance to use.public OkHttpServiceModule(okhttp3.OkHttpClient client,
ServiceConfiguration serviceConfiguration)
public java.lang.String type()
ServiceModuletype in interface ServiceModulepublic void configure(MobileCore core, ServiceConfiguration serviceConfiguration)
ServiceModuleconfigure in interface ServiceModulecore - MobileCore instanceserviceConfiguration - the configuration for the singleThreadServicepublic boolean requiresConfiguration()
ServiceModuletrue then an exception will be thrown
if singleThreadService configuration cannot be found.requiresConfiguration in interface ServiceModuletrue if the singleThreadService configuration should be defined.public void destroy()
ServiceModuledestroy in interface ServiceModulepublic HttpRequest newRequest()
HttpServiceModulenewRequest in interface HttpServiceModule