Re: Dead Hyperlinks - How do you check for them in advance
Re: Dead Hyperlinks - How do you check for them in advance
- Subject: Re: Dead Hyperlinks - How do you check for them in advance
- From: "Jonathan Fleming" <email@hidden>
- Date: Thu, 29 Jul 2004 14:31:40 +0100
Thanks Patrick,
That's just the sort of thing I was looking for.
Jonathan :^)
From: Patrick Robinson <email@hidden>
To: Jonathan Fleming <email@hidden>
CC: email@hidden
Subject: Re: Dead Hyperlinks - How do you check for them in advance
Date: Thu, 29 Jul 2004 08:48:56 -0400
On Jul 29, 2004, at 8:10 AM, Jonathan Fleming wrote:
How does one check in advance for dead links so that a WOHyperlink can be
turned off if this proves to be true?
Here is some code I've used (HttpURLConnection is in java.net):
public static boolean isValid(String url) {
try {
HttpURLConnection c = (HttpURLConnection)new
URL(url).openConnection();
c.setRequestMethod("HEAD");
return (c.getResponseCode() == HttpURLConnection.HTTP_OK);
} catch (IOException e) {
return false;
}
}
--
Patrick Robinson
AHNR Info Technology, Virginia Tech
email@hidden
_________________________________________________________________
Express yourself with cool new emoticons http://www.msn.co.uk/specials/myemo
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.