Example usage for java.net URLConnection getIfModifiedSince

List of usage examples for java.net URLConnection getIfModifiedSince

Introduction

In this page you can find the example usage for java.net URLConnection getIfModifiedSince.

Prototype

public long getIfModifiedSince() 

Source Link

Document

Returns the value of this object's ifModifiedSince field.

Usage

From source file:Main.java

public static void main(String args[]) throws Exception {

    URL u = new URL("http://www.java2s.com");
    URLConnection uc = u.openConnection();

    uc.setIfModifiedSince(1000);//  w w w . ja  v  a 2  s  .  c  om
    System.out.println(uc.getIfModifiedSince());
}

From source file:MainClass.java

public static void main(String[] args) {
    try {/*  w ww  .  ja va 2 s. c om*/
        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);
    }
}