URLConnection: setIfModifiedSince(long ifmodifiedsince)
import java.net.URL;
import java.net.URLConnection;
import java.util.Date;
public class MainClass {
public static void main(String[] args) {
try {
URLConnection uc = new URL("http://www.demo2s.com").openConnection();
System.out.println("Will retrieve file if it's been modified since "
+ new Date(uc.getIfModifiedSince()));
uc.setIfModifiedSince(System.currentTimeMillis());
System.out.println("Will retrieve file if it's been modified since "
+ new Date(uc.getIfModifiedSince()));
} catch (Exception e) {
System.err.println(e);
}
}
}
Home
Java Book
Networking
Java Book
Networking
URLConnection:
- URLConnection
- URLConnection: connect() throws IOException
- URLConnection: getContentEncoding()
- URLConnection: getExpiration()
- URLConnection: getHeaderFields()
- URLConnection: getHeaderField(int n)
- URLConnection: getHeaderFieldKey(int n)
- URLConnection: getIfModifiedSince()
- URLConnection: getLastModified()
- URLConnection: getURL()
- URLConnection: setAllowUserInteraction(boolean allowuserinteraction)
- URLConnection: setDoOutput(boolean dooutput)
- URLConnection: setIfModifiedSince(long ifmodifiedsince)
- URLConnection: setRequestProperty(String key, String value)
- URLConnection: setUseCaches(boolean usecaches)