Article:
  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

Main Topics Newest First

Showing messages 1 through 3 of 3.

  • 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 ?

    Andrew
  • 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/");

    hrl.setUserinfo("tomcat","tomcat");
    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(BaseProperty.java:130)
    at org.apache.webdav.lib.WebdavResource.processProperty(WebdavResource.java:4908)
    at org.apache.webdav.lib.WebdavResource.setWebdavProperties(WebdavResource.java:1066)
    at org.apache.webdav.lib.WebdavResource.setNamedProp(WebdavResource.java:968)
    at org.apache.webdav.lib.WebdavResource.setBasicProperties(WebdavResource.java:912)
    at org.apache.webdav.lib.WebdavResource.setProperties(WebdavResource.java:1894)
    at org.apache.webdav.lib.WebdavResource.setHttpURL(WebdavResource.java:1301)
    at org.apache.webdav.lib.WebdavResource.setHttpURL(WebdavResource.java:1320)
    at org.apache.webdav.lib.WebdavResource.setHttpURL(WebdavResource.java:1408)
    at org.apache.webdav.lib.WebdavResource.<init>(WebdavResource.java:290)
    at test.FileUploadServlet.doPost(FileUploadServlet.java:122)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
    at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
    at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
    at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
    at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:258)
    at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
    at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
    at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:872)
    at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:491)
    at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:173)
    at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:79)
    at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:199)
    at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
    at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
    at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:331)
    at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
    at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:432)
    at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:343)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:592)


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

    Mark,

    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!

    MikeWilkinson
    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.