Class OkHttpConnector
- java.lang.Object
-
- org.kohsuke.github.extras.okhttp3.OkHttpConnector
-
- All Implemented Interfaces:
HttpConnector
public class OkHttpConnector extends Object implements HttpConnector
HttpConnectorforOkHttpClient.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- Author:
- Liam Newman, Kohsuke Kawaguchi
-
-
Field Summary
-
Fields inherited from interface org.kohsuke.github.HttpConnector
DEFAULT, OFFLINE
-
-
Constructor Summary
Constructors Constructor Description OkHttpConnector(okhttp3.OkHttpClient client)Instantiates a new Ok http connector.OkHttpConnector(okhttp3.OkHttpClient client, int cacheMaxAge)Instantiates a new Ok http connector.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HttpURLConnectionconnect(URL url)Opens a connection to the given URL.
-
-
-
Constructor Detail
-
OkHttpConnector
public OkHttpConnector(okhttp3.OkHttpClient client)
Instantiates a new Ok http connector.- Parameters:
client- the client
-
OkHttpConnector
public OkHttpConnector(okhttp3.OkHttpClient client, int cacheMaxAge)Instantiates a new Ok http connector.- Parameters:
client- the clientcacheMaxAge- the cache max age
-
-
Method Detail
-
connect
public HttpURLConnection connect(URL url) throws IOException
Description copied from interface:HttpConnectorOpens a connection to the given URL.- Specified by:
connectin interfaceHttpConnector- Parameters:
url- the url- Returns:
- the http url connection
- Throws:
IOException- the io exception
-
-