Solved

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

Posted on 2011-02-17
8
272 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
 
LVL 92

Expert Comment

by:objects
ID: 34923472
not unless they including it some other custom header
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 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This video teaches viewers about errors in exception handling.

896 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now