Solved

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

Posted on 2011-02-17
8
271 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

747 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

14 Experts available now in Live!

Get 1:1 Help Now