Hi, I had the same problem; try doing the following:
File fn = new File(fileName); String path = "http://localhost:8080/slide/files/" + fn.getName(); wdr.putMethod(path, fn); Hope that helps! Clive -----Original Message----- From: Zoltan [mailto:[EMAIL PROTECTED] Sent: 08 February 2005 09:48 PM To: [email protected] Subject: failed to programatically upload file Hello, I have downloaded and deployed slide.war to my Jboss 4.0.1 deploy folder (under Windows XP SP1). On the client side, I have jakarta-slide-webdavlib-2.1.jar in my build path. I've tried to upload a file using the following snippet of code: try { HttpURL hrl = new HttpURL(url); WebdavResource wdr = new WebdavResource(hrl); File fn = new File(fileName); wdr.putMethod(fn); wdr.close(); } catch(MalformedURLException mue) { String msg = "(UploadFile) execute : wrong fileName passed: " + fileName; log.debug (msg, mue); } catch(HttpException he) { String msg = "(UploadFile) execute : HTTP exception occured "; log.debug (msg, he); } catch(IOException ioe) { String msg = "(UploadFile) execute : IO exception occured "; log.debug (msg, ioe); } At run-time the url passed is : http://localhost:8080/slide/files and the fileName is /DJ/images/16.jpg (the correct location of the file on my local machine). The upload fails and I see the following on the Jboss console: 12:05:31,359 INFO [STDOUT] http-0.0.0.0-8080-Processor24, 08-Feb-2005 12:05:31, unauthenticated, PROPFIND, 207 "Multi-Status", 31 ms, /files 12:05:31,578 INFO [STDOUT] http-0.0.0.0-8080-Processor24, 08-Feb-2005 12:05:31, unauthenticated, PUT, 403 "Forbidden", 0 ms, /files I read some articles about authentication problems with Slide and, as a result, I have modified the domain.xml file like: <permission action="all" subject="/roles/root" inheritable="true"/> <permission action="/actions/read-acl" subject="all" inheritable="true" negative="true"/> <permission action="/actions/write-acl" subject="all" inheritable="true" negative="true"/> <permission action="/actions/unlock" subject="all" inheritable="true" negative="true"/> <permission action="/actions/read" subject="all" inheritable="true"/> <!-- /users --> <objectnode classname="org.apache.slide.structure.SubjectNode" uri="/users"> <permission action="all" subject="self" inheritable="true"/> <!--<permission action="all" subject="unauthenticated" inheritable="true" negative="true"/>--> <permission action="/actions" subject="/users/guest"/> <!-- /users/root represents the administrator --> <objectnode classname="org.apache.slide.structure.SubjectNode" uri="/users/root"> <revision> <property namespace="http://jakarta.apache.org/slide/" name="password"/> </revision> </objectnode> <!-- /users/john and /users/john2 represent authenticated users --> <objectnode classname="org.apache.slide.structure.SubjectNode" uri="/users/john"> <revision> <property namespace="http://jakarta.apache.org/slide/" name="password"/> </revision> </objectnode> <objectnode classname="org.apache.slide.structure.SubjectNode" uri="/users/john2"> <revision> <property namespace="http://jakarta.apache.org/slide/" name="password"/> </revision> </objectnode> <!-- /users/guest represents an authenticated or unauthenticated guest user --> <objectnode classname="org.apache.slide.structure.SubjectNode" uri="/users/guest"> <revision> <property namespace="http://jakarta.apache.org/slide/" name="password"/> </revision> </objectnode> </objectnode> Note: I don't have any problems in uploading the same file using the slide client: [LOCALHOST:/slide/files/] C:\jakarta-slide-webdavclient-bin-2.1\bin $ put /dj/images/16.jpg Could anyone tell me what do I do wrong? Is there a configuration issue? Kind regards, Zoltan Lazar --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
