List Info

Thread: putMethod




putMethod
country flaguser name
United States
2007-08-17 12:28:36
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://local
host: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


Re: putMethod
country flaguser name
Germany
2007-08-17 09:37:47
Hey,

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

e.g.: 
webdavResource.putMethod("h
ttp://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://local
host: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-unsubscribejakarta.apache.org
For additional commands, e-mail: slide-user-helpjakarta.apache.org


Re: putMethod
country flaguser name
United States
2007-08-17 21:47:33
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"
<matthias8283gmx.at>
To: "Slide Users Mailing List" <slide-userjakarta.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("h
ttp://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://local
host: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-unsubscribejakarta.apache.org
> For additional commands, e-mail: slide-user-helpjakarta.apache.org
>
> 


------------------------------------------------------------
---------
To unsubscribe, e-mail: slide-user-unsubscribejakarta.apache.org
For additional commands, e-mail: slide-user-helpjakarta.apache.org


[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )