Re: Java Client - putMethod for a new file in a new directory
Thanks. It works now. Regards, Luanne --- Ingo Brunberg <[EMAIL PROTECTED]> wrote: > Your path is not correct. Try > > success = res.mkcolMethod("/slide/files/testDir"); > > Remember to alway specify the full path starting > from root. > > Ingo > > > Hello Amr, > > > > This is in response to your reply to Luke- > "putMethod > > for a new file in a new directory". > > I am new to Slide and installed the Slide-Tomcat > > bundle. I can access http://localhost:8080/slide > via > > my browser with username=root and password=root. > > > > I am trying to create a new file in a new > directory as > > suggested by you. As of now, there are no files or > > directories existing except what was created by > Slide. > > > > I am trying this: > > > > > > String status=""; > > boolean success=false; > > try { > > HttpURL homeUrl = new > > HttpURL("http://localhost:8080/slide/files";); > > homeUrl.setUserinfo("root","root"); > > res = new WebdavResource(homeUrl); > > if(res==null) { > > System.out.println("Null Connection"); > > } > > else { > > System.out.println("Got a connection"); > > } > > success=res.mkcolMethod("/testDir"); > > System.out.println("mkcolMethod: " + success); > > System.out.println("Status: " + > > res.getStatusMessage()); > > > > > success=res.putMethod("/testDir/testFile","test"); > > System.out.println("putMethod: " + success); > > status=res.getStatusMessage(); > > } > > catch(HttpException he) { > > System.out.println(he); > > status="HttpException"; > > } > > catch(IOException ioe) { > > System.out.println(ioe); > > status="IOException"; > > } > > catch(Exception e) { > > System.out.println(e); > > status="Exception"; > > } > > finally { > > return status; > > } > > > > > > My console output shows: > > http8080-Processor24, 10-Jun-2004 14:26:55, root, > > PROPFIND, 207 "Multi-Status", > > 1362 ms, /files > > Got a connection > > mkcolMethod: false > > Status: Not Implemented (501) > > putMethod: false > > > > Could you please help? > > > > Thanks > > Luanne > > > > > > > > > > __ > > Do you Yahoo!? > > Friends. Fun. Try the all-new Yahoo! Messenger. > > http://messenger.yahoo.com/ > > > > > - > > To unsubscribe, e-mail: > [EMAIL PROTECTED] > > For additional commands, e-mail: > [EMAIL PROTECTED] > > > > > - > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > __ Do you Yahoo!? Friends. Fun. Try the all-new Yahoo! Messenger. http://messenger.yahoo.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Java Client - putMethod for a new file in a new directory
Your path is not correct. Try success = res.mkcolMethod("/slide/files/testDir"); Remember to alway specify the full path starting from root. Ingo > Hello Amr, > > This is in response to your reply to Luke- "putMethod > for a new file in a new directory". > I am new to Slide and installed the Slide-Tomcat > bundle. I can access http://localhost:8080/slide via > my browser with username=root and password=root. > > I am trying to create a new file in a new directory as > suggested by you. As of now, there are no files or > directories existing except what was created by Slide. > > I am trying this: > > > String status=""; > boolean success=false; > try { > HttpURL homeUrl = new > HttpURL("http://localhost:8080/slide/files";); > homeUrl.setUserinfo("root","root"); > res = new WebdavResource(homeUrl); >if(res==null) { > System.out.println("Null Connection"); >} >else { > System.out.println("Got a connection"); > } > success=res.mkcolMethod("/testDir"); > System.out.println("mkcolMethod: " + success); > System.out.println("Status: " + > res.getStatusMessage()); > > success=res.putMethod("/testDir/testFile","test"); > System.out.println("putMethod: " + success); > status=res.getStatusMessage(); > } > catch(HttpException he) { > System.out.println(he); > status="HttpException"; > } > catch(IOException ioe) { > System.out.println(ioe); > status="IOException"; > } > catch(Exception e) { > System.out.println(e); > status="Exception"; > } > finally { > return status; > } > > > My console output shows: > http8080-Processor24, 10-Jun-2004 14:26:55, root, > PROPFIND, 207 "Multi-Status", > 1362 ms, /files > Got a connection > mkcolMethod: false > Status: Not Implemented (501) > putMethod: false > > Could you please help? > > Thanks > Luanne > > > > > __ > Do you Yahoo!? > Friends. Fun. Try the all-new Yahoo! Messenger. > http://messenger.yahoo.com/ > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Java Client - putMethod for a new file in a new directory
I forgot to mention that I have installed Slide as-is. I have not modified the configuration and not even configured a database. Is it necessary to configure one? I am just experimenting at this stage. Thanks Luanne --- Luanne Coutinho <[EMAIL PROTECTED]> wrote: > Hello Amr, > > This is in response to your reply to Luke- > "putMethod > for a new file in a new directory". > I am new to Slide and installed the Slide-Tomcat > bundle. I can access http://localhost:8080/slide via > my browser with username=root and password=root. > > I am trying to create a new file in a new directory > as > suggested by you. As of now, there are no files or > directories existing except what was created by > Slide. > > I am trying this: > > > String status=""; > boolean success=false; > try { > HttpURL homeUrl = new > HttpURL("http://localhost:8080/slide/files";); > homeUrl.setUserinfo("root","root"); > res = new WebdavResource(homeUrl); >if(res==null) { > System.out.println("Null Connection"); >} >else { > System.out.println("Got a connection"); > } > success=res.mkcolMethod("/testDir"); > System.out.println("mkcolMethod: " + success); > System.out.println("Status: " + > res.getStatusMessage()); > > > success=res.putMethod("/testDir/testFile","test"); > System.out.println("putMethod: " + success); > status=res.getStatusMessage(); > } > catch(HttpException he) { > System.out.println(he); > status="HttpException"; > } > catch(IOException ioe) { > System.out.println(ioe); > status="IOException"; > } > catch(Exception e) { > System.out.println(e); > status="Exception"; > } > finally { > return status; > } > > > My console output shows: > http8080-Processor24, 10-Jun-2004 14:26:55, root, > PROPFIND, 207 "Multi-Status", > 1362 ms, /files > Got a connection > mkcolMethod: false > Status: Not Implemented (501) > putMethod: false > > Could you please help? > > Thanks > Luanne > > > > > __ > Do you Yahoo!? > Friends. Fun. Try the all-new Yahoo! Messenger. > http://messenger.yahoo.com/ > > - > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > __ Do you Yahoo!? Friends. Fun. Try the all-new Yahoo! Messenger. http://messenger.yahoo.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Java Client - putMethod for a new file in a new directory
Hello Amr, This is in response to your reply to Luke- "putMethod for a new file in a new directory". I am new to Slide and installed the Slide-Tomcat bundle. I can access http://localhost:8080/slide via my browser with username=root and password=root. I am trying to create a new file in a new directory as suggested by you. As of now, there are no files or directories existing except what was created by Slide. I am trying this: String status=""; boolean success=false; try { HttpURL homeUrl = new HttpURL("http://localhost:8080/slide/files";); homeUrl.setUserinfo("root","root"); res = new WebdavResource(homeUrl); if(res==null) { System.out.println("Null Connection"); } else { System.out.println("Got a connection"); } success=res.mkcolMethod("/testDir"); System.out.println("mkcolMethod: " + success); System.out.println("Status: " + res.getStatusMessage()); success=res.putMethod("/testDir/testFile","test"); System.out.println("putMethod: " + success); status=res.getStatusMessage(); } catch(HttpException he) { System.out.println(he); status="HttpException"; } catch(IOException ioe) { System.out.println(ioe); status="IOException"; } catch(Exception e) { System.out.println(e); status="Exception"; } finally { return status; } My console output shows: http8080-Processor24, 10-Jun-2004 14:26:55, root, PROPFIND, 207 "Multi-Status", 1362 ms, /files Got a connection mkcolMethod: false Status: Not Implemented (501) putMethod: false Could you please help? Thanks Luanne __ Do you Yahoo!? Friends. Fun. Try the all-new Yahoo! Messenger. http://messenger.yahoo.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Java Client - putMethod for a new file in a new directory
Thank you, that seemed to do the trick. It was mkcolMethod that I had been looking for. Cheers Luke. - On 27 Apr 2004, at 17:43, Amr Elssamadisy wrote: This is a test that I have written that I think does what you want - hope it helps. /** * Expecting user name of test/test to allow a correct login and give * write permissions * @throws Exception */ public void testWebdavWriteWithNewDirectory() throws Exception{ long begin = System.currentTimeMillis(); homeUrl.setUserinfo("test","test"); WebdavResource res = new WebdavResource(homeUrl); assertTrue(res.exists()); try{ boolean success = res.mkcolMethod("/testDir"); assertTrue(res.getStatusMessage(),success);//write an dir success = res.putMethod("/testDir/testFile",""); assertTrue(res.getStatusMessage(),success);//write an empty file } finally{ res.deleteMethod(""); } long end = System.currentTimeMillis(); System.out.println("seconds running: "+ (end-begin)/1000); } luke noel-storr wrote: Hi, Using the slide Java client I'm trying to create a new file which I want to create in a directory that doesn't yet exist. I've tried several things, but can't get any to work. Say for example I want to create a new file at the URL: http://localhost:8080/slide/files/data/bob/newfile and the directory 'bob' does not yet exist, how would I go about doing this? here is an example of code I have tried: HttpURL httpURL = new HttpURL("http://localhost:8080/slide/files/data/bob/newfile";); wdr = new WebdavResource(httpURL, credentials, WebdavResource.NOACTION, DepthSupport.DEPTH_0); if (wdr.putMethod(bytes)) { System.out.println("YES!!"); } else { System.out.println("NO!!"); } I have also tried: HttpURL httpURL = new HttpURL("http://localhost:8080/slide/files/data/";); wdr = new WebdavResource(httpURL, credentials, WebdavResource.NOACTION, DepthSupport.DEPTH_0); if (wdr.putMethod("bob/newfile", bytes)) { System.out.println("YES!!"); } else { System.out.println("NO!!"); } Which also didn't work (and the directory 'data' does exist). Any pointers, I'm kind of lost here? Also, out of interest (and it may be related), how would I create a new empty directory? Cheers Luke. - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Amr Elssamadisy Developer,Researcher,Student (In no particular order...) tel: (413) 207-1225 email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Java Client - putMethod for a new file in a new directory
This is a test that I have written that I think does what you want - hope it helps. /** * Expecting user name of test/test to allow a correct login and give * write permissions * @throws Exception */ public void testWebdavWriteWithNewDirectory() throws Exception{ long begin = System.currentTimeMillis(); homeUrl.setUserinfo("test","test"); WebdavResource res = new WebdavResource(homeUrl); assertTrue(res.exists()); try{ boolean success = res.mkcolMethod("/testDir"); assertTrue(res.getStatusMessage(),success);//write an dir success = res.putMethod("/testDir/testFile",""); assertTrue(res.getStatusMessage(),success);//write an empty file } finally{ res.deleteMethod(""); } long end = System.currentTimeMillis(); System.out.println("seconds running: "+ (end-begin)/1000); } luke noel-storr wrote: Hi, Using the slide Java client I'm trying to create a new file which I want to create in a directory that doesn't yet exist. I've tried several things, but can't get any to work. Say for example I want to create a new file at the URL: http://localhost:8080/slide/files/data/bob/newfile and the directory 'bob' does not yet exist, how would I go about doing this? here is an example of code I have tried: HttpURL httpURL = new HttpURL("http://localhost:8080/slide/files/data/bob/newfile";); wdr = new WebdavResource(httpURL, credentials, WebdavResource.NOACTION, DepthSupport.DEPTH_0); if (wdr.putMethod(bytes)) { System.out.println("YES!!"); } else { System.out.println("NO!!"); } I have also tried: HttpURL httpURL = new HttpURL("http://localhost:8080/slide/files/data/";); wdr = new WebdavResource(httpURL, credentials, WebdavResource.NOACTION, DepthSupport.DEPTH_0); if (wdr.putMethod("bob/newfile", bytes)) { System.out.println("YES!!"); } else { System.out.println("NO!!"); } Which also didn't work (and the directory 'data' does exist). Any pointers, I'm kind of lost here? Also, out of interest (and it may be related), how would I create a new empty directory? Cheers Luke. - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Amr Elssamadisy Developer,Researcher,Student (In no particular order...) tel: (413) 207-1225 email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Java Client - putMethod for a new file in a new directory
Hi, Using the slide Java client I'm trying to create a new file which I want to create in a directory that doesn't yet exist. I've tried several things, but can't get any to work. Say for example I want to create a new file at the URL: http://localhost:8080/slide/files/data/bob/newfile and the directory 'bob' does not yet exist, how would I go about doing this? here is an example of code I have tried: HttpURL httpURL = new HttpURL("http://localhost:8080/slide/files/data/bob/newfile";); wdr = new WebdavResource(httpURL, credentials, WebdavResource.NOACTION, DepthSupport.DEPTH_0); if (wdr.putMethod(bytes)) { System.out.println("YES!!"); } else { System.out.println("NO!!"); } I have also tried: HttpURL httpURL = new HttpURL("http://localhost:8080/slide/files/data/";); wdr = new WebdavResource(httpURL, credentials, WebdavResource.NOACTION, DepthSupport.DEPTH_0); if (wdr.putMethod("bob/newfile", bytes)) { System.out.println("YES!!"); } else { System.out.println("NO!!"); } Which also didn't work (and the directory 'data' does exist). Any pointers, I'm kind of lost here? Also, out of interest (and it may be related), how would I create a new empty directory? Cheers Luke. - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]