本文整理汇总了Java中java.net.ResponseCache.getDefault方法的典型用法代码示例。如果您正苦于以下问题:Java ResponseCache.getDefault方法的具体用法?Java ResponseCache.getDefault怎么用?Java ResponseCache.getDefault使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.net.ResponseCache
的用法示例。
在下文中一共展示了ResponseCache.getDefault方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: copyWithDefaults
import java.net.ResponseCache; //导入方法依赖的package包/类
/**
* Returns a shallow copy of this OkHttpClient that uses the system-wide default for
* each field that hasn't been explicitly configured.
*/
private OkHttpClient copyWithDefaults() {
OkHttpClient result = new OkHttpClient(this);
result.proxy = proxy;
result.proxySelector = proxySelector != null ? proxySelector : ProxySelector.getDefault();
result.cookieHandler = cookieHandler != null ? cookieHandler : CookieHandler.getDefault();
result.responseCache = responseCache != null ? responseCache : ResponseCache.getDefault();
result.sslSocketFactory = sslSocketFactory != null
? sslSocketFactory
: HttpsURLConnection.getDefaultSSLSocketFactory();
result.hostnameVerifier = hostnameVerifier != null
? hostnameVerifier
: OkHostnameVerifier.INSTANCE;
result.authenticator = authenticator != null
? authenticator
: HttpAuthenticator.SYSTEM_DEFAULT;
result.connectionPool = connectionPool != null ? connectionPool : ConnectionPool.getDefault();
result.followProtocolRedirects = followProtocolRedirects;
result.transports = transports != null ? transports : DEFAULT_TRANSPORTS;
result.connectTimeout = connectTimeout;
result.readTimeout = readTimeout;
return result;
}
示例2: getInstalled
import java.net.ResponseCache; //导入方法依赖的package包/类
/**
* Returns the currently-installed {@code HttpResponseCache}, or null if there is no cache
* installed or it is not a {@code HttpResponseCache}.
*/
public static HttpResponseCache getInstalled() {
ResponseCache installed = ResponseCache.getDefault();
if (installed instanceof HttpResponseCache) {
return (HttpResponseCache) installed;
}
return null;
}
示例3: close
import java.net.ResponseCache; //导入方法依赖的package包/类
/**
* Uninstalls the cache and releases any active resources. Stored contents will remain on the
* filesystem.
*/
@Override public void close() throws IOException {
if (ResponseCache.getDefault() == this) {
ResponseCache.setDefault(null);
}
shimResponseCache.close();
}
示例4: delete
import java.net.ResponseCache; //导入方法依赖的package包/类
/**
* Uninstalls the cache and deletes all of its stored contents.
*/
public void delete() throws IOException {
if (ResponseCache.getDefault() == this) {
ResponseCache.setDefault(null);
}
shimResponseCache.delete();
}
示例5: openUrl
import java.net.ResponseCache; //导入方法依赖的package包/类
private URLConnection openUrl(HttpUrl url) {
ResponseCache responseCache = ResponseCache.getDefault();
AndroidInternal.setResponseCache(urlFactory, responseCache);
return urlFactory.open(url.url());
}
示例6: run
import java.net.ResponseCache; //导入方法依赖的package包/类
public ResponseCache run() {
return ResponseCache.getDefault();
}