Sliding into WebDAV
Subject:   Corrections for A Simple Example code
Date:   2004-07-12 10:56:56
From:   szpak
I could not get the SlideTest code to compile as listed in this article. Here are the corrections I made to get it to compile:

  • Instead of import org.apache.util.httpURL;, I used import org.apache.commons.httpclient.HttpURL;

  • Instead of hrl.setUserInfo("user", "pass");, I used hrl.setUserinfo("user", "pass");

With these changes the code to get a file compiled and ran properly.

I could not get the code for uploading a file to work. wdr.putMethod(fn) returns a boolean. When getting a file getMethod(fn) returns true, but when trying to upload a file putMethod(fn) always returned false. After lots of hair pulling and searching FAQs and the Slide mailing list I was able to get it to work as follows:

String filename = "myLocalFilename";
File fn = new File(filename);
String path = wdr.getPath() + "/" + filename;
boolean rslt = wdr.putMethod(path,fn);

Hope this is helpful. Now on to more complex stuff...

- Mark

Full Threads Oldest First

Showing messages 1 through 7 of 7.

  • Corrections for A Simple Example code
    2005-06-06 07:36:05  MikeWilkinson [View]


    I cannot thank you enough!!!
    I was having the same issue and you saved me an enormous amount of grief!

    Thanks so much!
    I hope some day maybe I can post something that will help you or others as you helped me.

    You are the man!

    p.s. Thanks to the original article author as well even though there were a couple corrections that needed made for Slide 2.1 the article was helpful.
    • Corrections for A Simple Example code
      2008-02-21 16:48:11  WEBDAV [View]

      Hi ,

      I am new to WEBDAv,

      HttpURL hrl = new HttpURL("http://apsw0442evs/exchange/user/Inbox/?Cmd=contents#");
      wdr= new WebdavResource(hrl);

      Currently i am using this code to get a connection to microsoft exchange server.But i need some assistance how to retrieve emails from Inbox folder.

      Provide me the running code if you have....


  • Corrections for A Simple Example code
    2005-04-25 04:30:50  geetaChaurasia [View]

    the sample code given does not work when used with in servlet. i am using WSAD to develop servlet and tomcat 5.0.28 as a server.
    what could be the solution plz help.........

    code snippet is
    HttpURL hrl =new HttpURL("http://localhost:8080/webdav/");

    System.out.print("inside test");
    WebdavResource wdr = new WebdavResource(hrl);
    System.out.print("inside test "+wdr.getPath());

    the following error comes

    [4/25/05 4:26:19:448 PDT] 246246c2 SystemOut O inside testinside test
    [4/25/05 4:26:34:885 PDT] 246246c2 WebGroup E SRVE0026E: [Servlet Error]-[org.jdom.output.XMLOutputter: method <init>(Lorg/jdom/output/Format;)V not found]: java.lang.NoSuchMethodError: org.jdom.output.XMLOutputter: method <init>(Lorg/jdom/output/Format;)V not found
    at org.apache.webdav.lib.BaseProperty.getPropertyAsString(
    at org.apache.webdav.lib.WebdavResource.processProperty(
    at org.apache.webdav.lib.WebdavResource.setWebdavProperties(
    at org.apache.webdav.lib.WebdavResource.setNamedProp(
    at org.apache.webdav.lib.WebdavResource.setBasicProperties(
    at org.apache.webdav.lib.WebdavResource.setProperties(
    at org.apache.webdav.lib.WebdavResource.setHttpURL(
    at org.apache.webdav.lib.WebdavResource.setHttpURL(
    at org.apache.webdav.lib.WebdavResource.setHttpURL(
    at org.apache.webdav.lib.WebdavResource.<init>(
    at test.FileUploadServlet.doPost(
    at javax.servlet.http.HttpServlet.service(
    at javax.servlet.http.HttpServlet.service(

    • Corrections for A Simple Example code
      2007-10-10 10:29:14  Mr._G [View]

      You are missing the JDOM jar

  • Corrections for A Simple Example code
    2004-07-12 13:29:40  Andrew Anderson | [View]

    All the examples in the article worked when the article was published.

    Could it be you were using the newer version of Slide that was released in June 2004 ?

    • Corrections for A Simple Example code
      2005-04-25 07:12:45  geetaChaurasia [View]

      yes i have latest code downloaded from apache site.i am using jakarta-slide-webdavclient-src-2.1 for this purpose. yes i made some some corrections while using the code for eg: replaceAll method . i have written my own code for this.

      when used same corrected code with in java application the code works fine , how it is possible ?? i am using same code for both servlet and java application......
    • still uploading problem
      2005-03-10 21:07:45  Sliding_into_WebDAV [View]

      I use the following code to update a file exits in tomcat v 5.5.8 server machine periodically.
      the problem simply is that the file could not be uploaded though the returned boolean value is true. I suppose the files are uploaded to the defaul tomcat directory webapps/ROOT

      String url = "http://localhost:8080/";
      HttpClient client = new HttpClient(url);
      HttpURL hrl = new HttpURL(url);
      WebdavResource resource = new WebdavResource(hrl);
      String filename = "FileIndexPage.xml";
      File file = new File(filename);
      String path = resource.getPath() + "/" + filename;
      resource.putMethod( path,file );
      pleas help :-0