How can I know the date a webpage last-modified using Android Java? or how I can request for
If-Modified-Since: Allows a 304 Not Modified to be returned if content is unchanged
using http headers?
How can I know the date a webpage last-modified using Android Java? or how I can request for
If-Modified-Since: Allows a 304 Not Modified to be returned if content is unchanged
using http headers?
I could do it this way:
URL url = null;
try {
url = new URL("http://www.example.com/example.pdf");
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
HttpURLConnection httpCon = null;
try {
httpCon = (HttpURLConnection) url.openConnection();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
long date = httpCon.getLastModified();