tags:

views:

192

answers:

3

I have an application to build in Java, and I've got some questions to put.

Is there some way to know if one URL of a webpage is real? The user enters the URL and I have to test if it's real, or not.

How can I konw if one webpage has changes since one date, or what is the date of the last update?

In java how can I put an application running on pc boot, the application must run since the user turns on the computer.

+1  A: 

To check whether a url is valid you could try using a regular expression (regex for urls).

To know if a webpage has changed you can take a look at the http headers (reading http headers in java).

You can't make the program startup automatically on boot, the user must do that. However, you can write code to help the user set the program as startup app; this however depends on the operating system.

nan
+2  A: 

I'm not sure what kind of application you want to build. I'll assume it's a desktop application. In order to check if a URL exists, you should make a HTTP HEAD Request, and parse the results. HEAD can be used to check if the page has been modified. In order for an application to start when the PC boots, you have to add a registry entry under Windows; this process is explained here

Geo
A: 

I'm not sure what you mean by "real". If you mean "valid", then you can just construct a java.net.URL from a String and catch the resulting MalformedURLException if it's not valid. If you mean that there's actually something there, you could issue an HTTP HEAD request like Geo says, or you could just retrieve the content. HTTPUnit is particularly handy for retrieving web content.

HTTP headers may indicate when the content has changed, as nan suggested above. If you don't want to count on that you can just retrieve the page and store it, or even better, store a hash of the page content. See DigestOutputStream for generating a hash. On a subsequent check for changes you would simply compare the new hash with the the one you stored last time.

Nan is right about start on boot. What OS are you targeting?

Marty Lamb
This applications is to be used in Windows Systems
rpf