[prev in list] [next in list] [prev in thread] [next in thread]
List: slide-user
Subject: Re: Java Client - putMethod for a new file in a new directory
From: Luke Noel-Storr <lukens () dsl ! pipex ! com>
Date: 2004-04-28 9:42:12
Message-ID: 539026CA-98F8-11D8-BEC8-003065F675C4 () dsl ! pipex ! com
[Download RAW message or body]
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: slide-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: slide-user-help@jakarta.apache.org
>>
>
> --
> Amr Elssamadisy
>
> Developer,Researcher,Student
> (In no particular order...)
>
> tel: (413) 207-1225
> email: amr@elssamadisy.com
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic