public class OkHttpConnector extends Object implements HttpConnector
HttpConnector for OkHttpClient.
Unlike HttpConnector.DEFAULT, OkHttp does response caching. Making a conditional request against GitHubAPI and receiving a
304 response does not count against the rate limit. See http://developer.github.com/v3/#conditional-requests
DEFAULT, OFFLINE| Constructor and Description |
|---|
OkHttpConnector(okhttp3.OkHttpClient client)
Instantiates a new Ok http connector.
|
OkHttpConnector(okhttp3.OkHttpClient client,
int cacheMaxAge)
Instantiates a new Ok http connector.
|
| Modifier and Type | Method and Description |
|---|---|
HttpURLConnection |
connect(URL url)
Opens a connection to the given URL.
|
public OkHttpConnector(okhttp3.OkHttpClient client)
client - the clientpublic OkHttpConnector(okhttp3.OkHttpClient client,
int cacheMaxAge)
client - the clientcacheMaxAge - the cache max agepublic HttpURLConnection connect(URL url) throws IOException
HttpConnectorconnect in interface HttpConnectorurl - the urlIOException - the io exceptionCopyright © 2020. All rights reserved.