Class OkHttpUtils
java.lang.Object
io.jenkins.plugins.restlistparam.util.OkHttpUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidCloses the response cache when Jenkins stops, so no file in the Jenkins home stays open (Windows cannot delete open files).static okhttp3.CacheControlgetCacheControl(Integer minutesCached) static okhttp3.OkHttpClientLikegetClientWithProxyAndCache(String), with a call timeout that covers the whole request: DNS, connecting, sending the request and reading the response body.static okhttp3.OkHttpClientgetClientWithProxyAndCache(String httpEndpoint) Builds a OkHTTP client that respects any proxy set in the Jenkins 'Plugin Manager' and offers a response cache.
-
Method Details
-
getClientWithProxyAndCache
Builds a OkHTTP client that respects any proxy set in the Jenkins 'Plugin Manager' and offers a response cache. A proxy will only be applied if the host of thehttpEndpointis NOT part of the noProxy values. The response cache is only present if the creation on disk is possible, otherwise there is none.The client has no connect, read or write timeout; callers bound a request with a call timeout (see
getClient(String, Duration)).- Parameters:
httpEndpoint- the host of the endpoint will get looked up against the noProxy values- Returns:
- OkHttpClient setup with an appropriate httpProxy value and response cache
-
getClient
LikegetClientWithProxyAndCache(String), with a call timeout that covers the whole request: DNS, connecting, sending the request and reading the response body.- Parameters:
httpEndpoint- the host of the endpoint will get looked up against the noProxy valuescallTimeout- how long the call may take; must be positive
-
getCacheControl
-