URLConnection getDefaultUseCaches Example
URLConnection class getDefaultUseCaches example. This example shows you how to use getDefaultUseCaches method.
URLConnection class getDefaultUseCaches example. public boolean getDefaultUseCaches() Returns the default value of a URLConnection's useCaches flag. Ths default is "sticky", being a part of the static state of all URLConnections. This flag applies to the next, and all following URLConnections that are created.
Here is the code
/*
* @ # GetDefaultUseCaches.java
* A class repersenting use to GetDefaultUseCaches
* method of URLConnection class in java.net package
* version 23 June 2008
* author Rose India
*/
import java.net.*;
public class GetDefaultUseCaches {
public static void main(String args[]) throws Exception {
SocketAddress socketAddress =
new InetSocketAddress("192.168.10.80", 9090);
Proxy proxy = new Proxy(Proxy.Type.HTTP, socketAddress);
URL url = new URL("http://google.com");
URLConnection connection = url.openConnection(proxy);
System.out.println("Default Use Caches " +
connection.getDefaultUseCaches());
}
} |
|