下面列出了java.net.ResponseCache#setDefault ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* 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);
}
delegate.close();
}
/**
* Uninstalls the cache and deletes all of its stored contents.
*/
public void delete() throws IOException {
if (ResponseCache.getDefault() == this) {
ResponseCache.setDefault(null);
}
delegate.delete();
}
@Override protected void tearDown() throws Exception {
ResponseCache.setDefault(null);
Authenticator.setDefault(null);
System.clearProperty("proxyHost");
System.clearProperty("proxyPort");
System.clearProperty("http.proxyHost");
System.clearProperty("http.proxyPort");
System.clearProperty("https.proxyHost");
System.clearProperty("https.proxyPort");
server.shutdown();
restoreUrlCache(savedUrlCache);
server = null;
super.tearDown();
}
private void installHttpHandler(long httpCacheSize, File httpCacheDir ){
try{
HttpResponseCache result = new HttpResponseCache(httpCacheDir, httpCacheSize);
ResponseCache.setDefault(result);
URL.setURLStreamHandlerFactory(new OkHttpURLStreamHandlerFactory(new OkHttpClient()));
}catch(Exception e){
Ln.e(e, "Failed to set up okhttp");
}
}
public static void reset() {
// Set system wide cache handler
System.out.println("install deploy cache handler");
ResponseCache.setDefault(new TestCache());
}
public static void reset() {
// Set system wide cache handler
System.out.println("install deploy cache handler");
ResponseCache.setDefault(new TestCache());
}
public static void reset() {
// Set system wide cache handler
System.out.println("install deploy cache handler");
ResponseCache.setDefault(new TestCache());
}
public static void reset() {
// Set system wide cache handler
System.out.println("install deploy cache handler");
ResponseCache.setDefault(new TestCache());
}
public static void reset() {
// Set system wide cache handler
System.out.println("install deploy cache handler");
ResponseCache.setDefault(new TestCache());
}
public static void reset() {
// Set system wide cache handler
System.out.println("install deploy cache handler");
ResponseCache.setDefault(new TestCache());
}
public static void reset() {
// Set system wide cache handler
System.out.println("install deploy cache handler");
ResponseCache.setDefault(new TestCache());
}
public static void reset() {
// Set system wide cache handler
System.out.println("install deploy cache handler");
ResponseCache.setDefault(new TestCache());
}
public static void reset() {
// Set system wide cache handler
System.out.println("install deploy cache handler");
ResponseCache.setDefault(new TestCache());
}
public static void reset() {
// Set system wide cache handler
System.out.println("install deploy cache handler");
ResponseCache.setDefault(new TestCache());
}
public static void reset() {
// Set system wide cache handler
System.out.println("install deploy cache handler");
ResponseCache.setDefault(new TestCache());
}
public static void reset() {
// Set system wide cache handler
System.out.println("install deploy cache handler");
ResponseCache.setDefault(new TestCache());
}
public static void reset() {
// Set system wide cache handler
System.out.println("install deploy cache handler");
ResponseCache.setDefault(new TestCache());
}
static void init ()
{
if (ResponseCache.getDefault() == null) {
ResponseCache.setDefault(new JnlpResponseCache());
}
}