Solved

How to know if a web page's last update time

Posted on 2011-02-17
8
275 Views
Last Modified: 2012-05-11
Hi,

As noted above, I want to use Java to detect a web page's last update time via httpresponse, etc. I don't want to save the web page's contents and verify through the contents.

Thanks
0
Comment
Question by:wsyy
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 92

Expert Comment

by:objects
ID: 34922538
check the Last-Modified value in the http response header
0
 
LVL 92

Assisted Solution

by:objects
objects earned 41 total points
ID: 34922550
theres some code here that shows how to access the headers

http://helpdesk.objects.com.au/java/how-do-i-get-the-cookies-from-a-http-connection

If you just want the one value you can use

long lastModified = urlconnection.getLastModified();
0
 

Author Comment

by:wsyy
ID: 34923452
what if the header doesn't include the info? are there any other ways?
0
Microsoft Certification Exam 74-409

VeeamĀ® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
LVL 92

Expert Comment

by:objects
ID: 34923472
not unless they including it some other custom header
0
 
LVL 2

Accepted Solution

by:
calboronster earned 42 total points
ID: 34924969
As a caution comment, not a very good idea to detect browser time and take action because :

1. Browser time can be tampered by the end user.
2. There could be a real time difference between server and the client.

The best way is for the server to set a session token in response which can then be traced back in next responses and compared each time by the server for last access time (for that session token).
0
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 42 total points
ID: 34924978
You can generally only do that if the web page is a static file unless the site has some other means of announcing it.

It's worth checking if the If-Modified-Since header is set though - some sites implement this
0
 

Author Comment

by:wsyy
ID: 34925943
calboronster:

My crawling application wants to detect the changes of a web page ever since last crawl. The solution you provided seems that a good check can be done only on the server side which may not help my case.

Thanks
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 34971137
>>The solution you provided seems that a good check can be done only on the server side which may not help my case.

I wonder why you accepted it then?
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Find out what you should include to make the best professional email signature for your organization.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question