URLConnection: setUseCaches(boolean usecaches) : URLConnection « java.net « Java by API






URLConnection: setUseCaches(boolean usecaches)

 
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;

public class MainClass {

  public static void main(String[] args) {
    URL u;
    URLConnection uc;
    try {
      u = new URL("http://www.java2s.com");
      try {
        uc = u.openConnection();
        if (uc.getUseCaches()) {
          uc.setUseCaches(false);
        }
      } catch (IOException e) {
        System.err.println(e);
      }
    } catch (MalformedURLException e) {
      System.err.println(e);
    }

  }

}

           
         
  








Related examples in the same category

1.URLConnection: connect() throws IOException
2.URLConnection: getContentEncoding()
3.URLConnection: getContentType()
4.URLConnection: getExpiration()
5.URLConnection: getHeaderFields()
6.URLConnection: getHeaderField(int n)
7.URLConnection: getHeaderFieldKey(int n)
8.URLConnection: getInputStream()
9.URLConnection: getIfModifiedSince()
10.URLConnection: getLastModified()
11.URLConnection: getURL()
12.URLConnection: setAllowUserInteraction(boolean allowuserinteraction)
13.URLConnection: setDoInput(boolean doinput)
14.URLConnection: setDoOutput(boolean dooutput)
15.URLConnection: setIfModifiedSince(long ifmodifiedsince)
16.URLConnection: setRequestProperty(String key, String value)