Java Code Examples for java.net.ResponseCache#setDefault()

The following examples show how to use java.net.ResponseCache#setDefault() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HttpResponseCache.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
/**
 * Uninstalls the cache and deletes all of its stored contents.
 */
public void delete() throws IOException {
    if (ResponseCache.getDefault() == this) {
        ResponseCache.setDefault(null);
    }
    delegate.delete();
}
 
Example 2
Source File: CallerIDApplication.java    From callerid-for-android with GNU General Public License v3.0 5 votes vote down vote up
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");
    }
}
 
Example 3
Source File: URLConnectionTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example 4
Source File: HttpResponseCache.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
/**
 * 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();
}
 
Example 5
Source File: TestCache.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public static void reset() {
    // Set system wide cache handler
    System.out.println("install deploy cache handler");
    ResponseCache.setDefault(new TestCache());
}
 
Example 6
Source File: TestCache.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public static void reset() {
    // Set system wide cache handler
    System.out.println("install deploy cache handler");
    ResponseCache.setDefault(new TestCache());
}
 
Example 7
Source File: TestCache.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public static void reset() {
    // Set system wide cache handler
    System.out.println("install deploy cache handler");
    ResponseCache.setDefault(new TestCache());
}
 
Example 8
Source File: TestCache.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public static void reset() {
    // Set system wide cache handler
    System.out.println("install deploy cache handler");
    ResponseCache.setDefault(new TestCache());
}
 
Example 9
Source File: TestCache.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public static void reset() {
    // Set system wide cache handler
    System.out.println("install deploy cache handler");
    ResponseCache.setDefault(new TestCache());
}
 
Example 10
Source File: TestCache.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
public static void reset() {
    // Set system wide cache handler
    System.out.println("install deploy cache handler");
    ResponseCache.setDefault(new TestCache());
}
 
Example 11
Source File: TestCache.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public static void reset() {
    // Set system wide cache handler
    System.out.println("install deploy cache handler");
    ResponseCache.setDefault(new TestCache());
}
 
Example 12
Source File: TestCache.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public static void reset() {
    // Set system wide cache handler
    System.out.println("install deploy cache handler");
    ResponseCache.setDefault(new TestCache());
}
 
Example 13
Source File: TestCache.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public static void reset() {
    // Set system wide cache handler
    System.out.println("install deploy cache handler");
    ResponseCache.setDefault(new TestCache());
}
 
Example 14
Source File: TestCache.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
public static void reset() {
    // Set system wide cache handler
    System.out.println("install deploy cache handler");
    ResponseCache.setDefault(new TestCache());
}
 
Example 15
Source File: TestCache.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
public static void reset() {
    // Set system wide cache handler
    System.out.println("install deploy cache handler");
    ResponseCache.setDefault(new TestCache());
}
 
Example 16
Source File: TestCache.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
public static void reset() {
    // Set system wide cache handler
    System.out.println("install deploy cache handler");
    ResponseCache.setDefault(new TestCache());
}
 
Example 17
Source File: TestCache.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
public static void reset() {
    // Set system wide cache handler
    System.out.println("install deploy cache handler");
    ResponseCache.setDefault(new TestCache());
}
 
Example 18
Source File: JnlpResponseCache.java    From libreveris with GNU Lesser General Public License v3.0 4 votes vote down vote up
static void init ()
{
    if (ResponseCache.getDefault() == null) {
        ResponseCache.setDefault(new JnlpResponseCache());
    }
}