Re: Determining if an image exists
Re: Determining if an image exists
- Subject: Re: Determining if an image exists
- From: Karl Moskowski <email@hidden>
- Date: Thu, 17 Feb 2005 15:40:08 -0500
David,
I use a method like this to tell if an iCal file exists on a webdav
server. It should work with any kind of file at an http url.
public boolean fileExists(String httpUrl) {
boolean fileExists = true;
// use URL to parse the host, port and path out of the passed in
httpurl
URL url = new URL(httpUrl);
String host = url.getHost();
String urlPath = url.getPath();
int port = (url.getPort() == -1 ? 80 : url.getPort());
WOHTTPConnection connection = new WOHTTPConnection(host, port);
connection.setKeepAliveEnabled(false);
WORequest request = new WORequest("GET", urlPath, "HTTP/1.1", null,
null, null);
if (!connection.sendRequest(request))
fileExists = false;
return fileExists;
}
Regards,
Karl.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden