You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-user@jakarta.apache.org by Matthias Reischenbacher <ma...@gmx.at> on 2007/08/17 16:37:47 UTC

Re: putMethod

Hey,

try to use an absolute URL as parameter in the 'putMethod' method

e.g.: 
webdavResource.putMethod("http://localhost:8080/slide/files/slide/files", 
file)

Matthias

virtuallight wrote:
> I am trying to write some files to my store programatically utilizing the WebDavResource putMethod.  This all seems straight forward, at least on the surface.  Perhaps someone can explain to me why the following will succeed :
> boolean success = container.putMethod("/slide/files/myfile.txt", "some text/n");
> 
> and the following will fail with a 403 forbidden error:
> 
> url = new HttpURL("http://localhost:8080/slide/files/");
> 
> url.setUserinfo("root", "root");
> 
> container = new WebdavResource(url);
> 
> if (container == null)
> 
> {
> 
> System.out.println("Container is null.");
> 
> }
> 
> File file = new File("c:/pdfs/myfile.txt");
> 
> if(file.exists())
> 
> {
> 
> System.out.println("File is valid.");
> 
> boolean success = container.putMethod(file);
> 
> if(success)
> 
> {
> 
> System.out.println("File was added successfully.");
> 
> }
> 
> else
> 
> {
> 
> System.out.println("Failed to add file.");
> 
> }
> 
> I also tried this which failed as well.
> 
> boolean success = container.putMethod(/slide/files, file);
> 
> I have also tried using an inputstream with the same results.  It would seem to me that these are the same.  A file is created and written to /files.  I have tried this on both the bundled tomcat version with user name root, password root which should be the administrator and with a setup in which authentication is disabled.  Both yeild the same results.  What have I missed?  With authentication off should I not be able to do whatever I want?  I am using the 2.1 version of Slide.
> 
> Regards,
> 
> Bill
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org


Re: putMethod

Posted by virtuallight <vi...@hotmail.com>.
Matthias, thanks for the response.  I tried your suggestion and got the same 
result.  Maybe a better question would be does it work at all when passing 
in a file object or an inputstream?

Bill

----- Original Message ----- 
From: "Matthias Reischenbacher" <ma...@gmx.at>
To: "Slide Users Mailing List" <sl...@jakarta.apache.org>
Sent: Friday, August 17, 2007 7:37 AM
Subject: Re: putMethod


> Hey,
>
> try to use an absolute URL as parameter in the 'putMethod' method
>
> e.g.: 
> webdavResource.putMethod("http://localhost:8080/slide/files/slide/files", 
> file)
>
> Matthias
>
> virtuallight wrote:
>> I am trying to write some files to my store programatically utilizing the 
>> WebDavResource putMethod.  This all seems straight forward, at least on 
>> the surface.  Perhaps someone can explain to me why the following will 
>> succeed :
>> boolean success = container.putMethod("/slide/files/myfile.txt", "some 
>> text/n");
>>
>> and the following will fail with a 403 forbidden error:
>>
>> url = new HttpURL("http://localhost:8080/slide/files/");
>>
>> url.setUserinfo("root", "root");
>>
>> container = new WebdavResource(url);
>>
>> if (container == null)
>>
>> {
>>
>> System.out.println("Container is null.");
>>
>> }
>>
>> File file = new File("c:/pdfs/myfile.txt");
>>
>> if(file.exists())
>>
>> {
>>
>> System.out.println("File is valid.");
>>
>> boolean success = container.putMethod(file);
>>
>> if(success)
>>
>> {
>>
>> System.out.println("File was added successfully.");
>>
>> }
>>
>> else
>>
>> {
>>
>> System.out.println("Failed to add file.");
>>
>> }
>>
>> I also tried this which failed as well.
>>
>> boolean success = container.putMethod(/slide/files, file);
>>
>> I have also tried using an inputstream with the same results.  It would 
>> seem to me that these are the same.  A file is created and written to 
>> /files.  I have tried this on both the bundled tomcat version with user 
>> name root, password root which should be the administrator and with a 
>> setup in which authentication is disabled.  Both yeild the same results. 
>> What have I missed?  With authentication off should I not be able to do 
>> whatever I want?  I am using the 2.1 version of Slide.
>>
>> Regards,
>>
>> Bill
>>
>>
>>
>
> ---------------------------------------------------------------------
> 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