String
server_prot = "http";
String
server =
"exchange.foo.com";
String
path =
server_prot+"://"+server+path;
if (server_prot.equals("https")){
url =
new HttpsURL(path);
} else
{
url =
new HttpURL(path);
}
url.setUserinfo((gen_domain!=null?gen_domain+"\\":"")+gen_userID,gen_pass);
WebdavResource rc = new
WebdavResource(url,true);
SubscribeMethod sub = new
SubscribeMethod(path);
sub.setCallback("http://"+InetAddress.getLocalHost().getHostAddress()+"/index.html");
sub.setNotificationDelay(1);
sub.setDepth(1);
sub.setNotificationType(Subscription.UPDATE_NOTIFICATION);
sub.setSubsciptionLifetime(300);
sub.setDebug(1);
rc.executeHttpRequestMethod(rc.getSessionInstance(url),sub);
Enumeration e =
sub.getResponses();
while
(e.hasMoreElements()){
System.out.println(e.nextElement());
}