Hi. Sorry I can't help, but I, too, get a problem trying to do the same
thing. I can do gets successfully.
Source:
public static void main(String[] args) throws Exception{
String remote = "http://145.246.92.204:8082/Temp/portia";
File ff = new File("C:
\\apps\\jakarta-slide-1.0.16\\src\\webdav\\client\\src\\bob.txt");
try {
HttpURL url = new HttpURL(remote);
url.setUserInfo("portia", "");
WebdavResource wdr = new WebdavResource(url);
wdr.putMethod( new URL(remote).getPath() , ff );
} catch (IOException e) {
e.printStackTrace();
}
}
Details of request:
[SMURF] method name: PUT
[SMURF] header elem: Cookie:
$Version=1;JSESSIONID=7D1F35EDBF871A8494A528A4FEC79D3C; $Path=/;
$Domain=145.246.92.204;sdata=9fe84e:f3b9403a04:-7e26; $Path=/;
$Domain=145.246.92.204
[SMURF] header elem: Host: 145.246.92.204:8082
[SMURF] header elem: User-Agent: Jakarta HTTP Client/1.0
[SMURF] path: /Temp/portia
[SMURF] status code: -1
[SMURF} statusline = HTTP/1.0 400 Bad Request
Process terminated with exit code 0
|---------+---------------------------->
| | Naushin Gandhi |
| | <[EMAIL PROTECTED]|
| | racle.com> |
| | |
| | 05/03/2003 15:48 |
| | Please respond to|
| | "Slide Users |
| | Mailing List" |
| | |
|---------+---------------------------->
>---------------------------------------------------------------------------------------------------------------|
|
|
| To: [EMAIL PROTECTED], "Pill, Juergen" <[EMAIL PROTECTED]>
|
| cc:
|
| Subject: Put Method throws HttpException(Urgent)
|
>---------------------------------------------------------------------------------------------------------------|
Hello
Im facing a problem here when I'm trying to save the file through my
java based application to the webdav folders. I have pasted the snippet
of my code along with the exception.
Please let me know what exactly is required to do here in order to save
to the webdav folders. The webresource folder status message - OK (2xx)
but it throws an exception and does not write file to webdav folder.
I was successfully able to do a getMethod(..), but however the write to
dav server is not working.
Please throw any light on this matter, and let us know if there is
anything im missing here.
thank you..
LIBRARIES USED: (reference:
http://jakarta.apache.org/slide/clientjavadoc/index.html)
import org.apache.webdav.lib.*;
import org.apache.webdav.lib.methods.*;
import org.apache.util.*;
CODE:
public void saveToDav(String fileURI) {
WebdavResource webres=null;
String url = "http://some.server.com:8080/";
try {
URI file_uri = new URI(fileURI);
File ff = new File(file_uri.getPath());
HttpURL httpURL = new HttpURL("http://some.server.com:8080/");
httpURL.setUserInfo("username","password");
webres = new WebdavResource(httpURL,"public/");
if(ff.exists()) {
boolean done = webres.putMethod(ff);
System.out.println("result : " + done);
}
}
catch(Exception e) {
System.out.println("Exception " + e.getMessage());
System.out.println("webresource status message :
"+webres.getStatusMessage());
e.printStackTrace(System.out);
}
}
EXCEPTION:
Exception Unable to process request
webresource status message : OK (200)
org.apache.commons.httpclient.HttpException: Unable to process request
at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:657)
at
org.apache.webdav.lib.WebdavResource.putMethod(WebdavResource.java:2283)
at
org.apache.webdav.lib.WebdavResource.putMethod(WebdavResource.java:2259)
Regards
Naushin
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
**********************************************************************************
This email may contain confidential material. If you were not an
intended recipient, please notify the sender and delete all copies.
We may monitor email to and from our network.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]