Solved

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

Posted on 2011-02-17
8
283 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
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

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

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

In this post we will learn different types of Android Layout and some basics of an Android App.
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

688 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