RE: WebdavResource putMethod InputStream as parameter

2006-04-13 Thread Jimi Dawlton

thanks for the reply Miguel,

i managed to upload the file in the end by passing a File object in the 
parameter instead, like so:


String filename = "test.txt";
File file = new File("C:/" + filename);
webdavResource.putMethod(serverPath, file);

this has worked successfully, and i'm not sure why the other way didn't 
work, since both methods are quite similar.


i'll keep in mind your method if i need to use it in the future though,

thanks,

dawlton.




From: "Miguel Figueiredo" <[EMAIL PROTECTED]>
Reply-To: "Slide Users Mailing List" 
To: "'Slide Users Mailing List'" 
Subject: RE: WebdavResource putMethod InputStream as parameter
Date: Thu, 13 Apr 2006 10:10:57 +0100


Hello Jimi,

 Here is a code snippet, which I'm using with success, which uses a put
method relying on an input stream:

WebdavResource source = WebdavUtils.setupWebdavConnection(sourceLocation);
WebdavResource target = WebdavUtils.setupWebdavConnection(targetLocation);

InputStream is = source.getMethodData();
sucess = target.putMethod(is);

is.close();
source.close();
target.close();


The setupWebdavConnection is just a helper method that sets up the web 
proxy

and username/password information on a WebdavResource instance.

Hope this helps,
Miguel Figueiredo

-Original Message-
From: Jimi Dawlton [mailto:[EMAIL PROTECTED]
Sent: quarta-feira, 12 de Abril de 2006 21:45
To: slide-user@jakarta.apache.org
Subject: WebdavResource putMethod InputStream as parameter

hi,

i was wondering if anyone has successfully managed to upload a file using
the putMethod with the InputStream as the parameter, (of the client)?

i have been trying to use:

putMethod(java.lang.String path, java.io.InputStream is)

but when i pass an inputstream, e.g:

N.B. (i've only shown an extract):

String filename = "test.txt";
File f = new File("C:/" + filename);
InputStream inputStream = new FileInputStream(f);
webdavResource.putMethod(serverPath, inputStream);


i get the exception:

java.net.SocketException: Software caused connection abort: recv failed

am i using the method incorrectly or do i need to setup some sort of
bufferedReader of file bufferedReader???


dawlton.


Disclaimer: My advice comes as is, without any guarantee. Use it at your
discretion. I cannot be held responsible for your actions.


_
Are you using the latest version of MSN Messenger? Download MSN Messenger 
7.5 today! http://join.msn.com/messenger/overview



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: WebdavResource putMethod InputStream as parameter

2006-04-13 Thread Miguel Figueiredo

Hello Jimi,

 Here is a code snippet, which I'm using with success, which uses a put
method relying on an input stream:

WebdavResource source = WebdavUtils.setupWebdavConnection(sourceLocation);
WebdavResource target = WebdavUtils.setupWebdavConnection(targetLocation);

InputStream is = source.getMethodData();
sucess = target.putMethod(is);

is.close();
source.close();
target.close();


The setupWebdavConnection is just a helper method that sets up the web proxy
and username/password information on a WebdavResource instance.

Hope this helps,
Miguel Figueiredo

-Original Message-
From: Jimi Dawlton [mailto:[EMAIL PROTECTED] 
Sent: quarta-feira, 12 de Abril de 2006 21:45
To: slide-user@jakarta.apache.org
Subject: WebdavResource putMethod InputStream as parameter

hi,

i was wondering if anyone has successfully managed to upload a file using 
the putMethod with the InputStream as the parameter, (of the client)?

i have been trying to use:

putMethod(java.lang.String path, java.io.InputStream is)

but when i pass an inputstream, e.g:

N.B. (i've only shown an extract):

String filename = "test.txt";
File f = new File("C:/" + filename);
InputStream inputStream = new FileInputStream(f);
webdavResource.putMethod(serverPath, inputStream);


i get the exception:

java.net.SocketException: Software caused connection abort: recv failed

am i using the method incorrectly or do i need to setup some sort of 
bufferedReader of file bufferedReader???


dawlton.


Disclaimer: My advice comes as is, without any guarantee. Use it at your 
discretion. I cannot be held responsible for your actions.

_
Are you using the latest version of MSN Messenger? Download MSN Messenger 
7.5 today! http://join.msn.com/messenger/overview


-
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]