Java HTTP Header getLastModifiedHeader(URL url)

Here you can find the source of getLastModifiedHeader(URL url)

Description

get Last Modified Header

License

Open Source License

Declaration

public static long getLastModifiedHeader(URL url) throws IOException 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.IOException;

import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;

public class Main {
    public static long getLastModifiedHeader(URL url) throws IOException {
        URLConnection conn = url.openConnection();
        try {/*  w w w  .j av a2 s  . c  om*/
            if (conn instanceof HttpURLConnection) {
                ((HttpURLConnection) conn).setRequestMethod("HEAD");
            }
            return conn.getLastModified();
        } finally {
            if (conn instanceof HttpURLConnection) {
                ((HttpURLConnection) conn).disconnect();
            }
        }
    }
}

Related

  1. getConnection(URL url, String method, Map header, String ctype)
  2. getFromUrl(Map headerMap, URL loc, Proxy proxy)
  3. getHeaderField(final URL url, final String name)
  4. getHttpResponseHeader(HttpURLConnection http)
  5. getIntFromHeader(HttpURLConnection connection, String headerName)
  6. getServerHeader(URL httpURL)
  7. getURLHeaders(String u)
  8. printHeaderFields(final URL url)
  9. printHttpURLConnectionHeaders(HttpURLConnection httpURLConnection)