Hi
I trying my first example ever with SLIDE and doesn't seem to get it
right.
I get a "followRedirects is disabled" response, but have absolutely no
idea why. So any help would be appreciated.
My aim is to access MS Exchange server so that I can update the public
folder for example. And of course if you have a better alternative to
accessing MS Exchange, then I'm more than happy to listen to any
suggestions. I have only found the Compoze-library which costs a lot of
money, and then SLIDE which I'm trying to use now.
The source code is as follows:
package com.tobias.webdav;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.HttpURL;
import org.apache.webdav.lib.WebdavResource;
/**
* @author tobias
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class WebDAVTest {
public static void main (String args[])
{
try
{
HttpURL hrl = new
HttpURL("http://oden/exchange/tobias/Notes");
hrl.setUserinfo("tobias","lindae77");
WebdavResource wdr = new WebdavResource(hrl);
File fn = new File("remote-file");
String arr[] = wdr.list();
int i=arr.length;
while( --i >= 0 ) {
System.out.println( "["+i+"] "+arr[ i ] );
}
wdr.close();
}
catch(MalformedURLException mue)
{
System.out.println( "exception "+mue );
mue.printStackTrace();
}
catch(HttpException he)
{
System.out.println( "exception; "+he );
he.printStackTrace();
}
catch(IOException ioe)
{
System.out.println( "exception; "+ioe );
ioe.printStackTrace();
}
}
}
Output when I run the program above:
Sep 20, 2004 2:19:51 PM org.apache.commons.httpclient.HttpMethodBase
processRedirectResponse INFO: Redirect requested but followRedirects is
disabled
exception; org.apache.commons.httpclient.HttpException
org.apache.commons.httpclient.HttpException
at
org.apache.webdav.lib.WebdavResource.propfindMethod(WebdavResource.java:
3185)
at
org.apache.webdav.lib.WebdavResource.propfindMethod(WebdavResource.java:
3145)
at
org.apache.webdav.lib.WebdavResource.setNamedProp(WebdavResource.java:87
9)
at
org.apache.webdav.lib.WebdavResource.setBasicProperties(WebdavResource.j
ava:824)
at
org.apache.webdav.lib.WebdavResource.setProperties(WebdavResource.java:1
746)
at
org.apache.webdav.lib.WebdavResource.setHttpURL(WebdavResource.java:1156
)
at
org.apache.webdav.lib.WebdavResource.setHttpURL(WebdavResource.java:1175
)
at
org.apache.webdav.lib.WebdavResource.setHttpURL(WebdavResource.java:1261
)
at
org.apache.webdav.lib.WebdavResource.<init>(WebdavResource.java:274)
at com.tobias.webdav.WebDAVTest.main(WebDAVTest.java:32)