Code example for URLConnection

Methods: getLastModified

0
  private long getLastModified(URL url) {
    long lastModified = 0;
 
    try { 
      URLConnection conn = url.openConnection();
      lastModified = conn.getLastModified();
    } catch (Exception e) {
      // Do nothing 
    } 
 
    if (lastModified == 0) {
      String filepath = url.getPath();
      if (filepath != null) {
        File f = new File(filepath);
        if (f.exists()) {
          lastModified = f.lastModified();
        } 
      } 
    } 
 
Stop searching for code, let great code find you!  Add Codota to your java IDE