hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yannick PIERSON" <piers...@gmail.com>
Subject HttpClient_3.1store file
Date Mon, 21 Apr 2008 16:46:23 GMT
Hi,
I'm using the library HttpClient 3.1 and I'm trying to store a file on a
server web.

For that I ever done :
HttpClient client = new HttpClient();

Credentials credentials = new NTCredentials("test", "test", "homecomputer ",
"WORKGROUP");
HttpState state = client.getState();
state.setCredentials(null, null, credentials);

PutMethod put = new PutMethod("http://noname/webdav_acces/");
put.setRequestBody(new FileInputStream("c:\\temp\\myFileToStore.pdf"));
client.executeMethod(put);

put.releaseConnection();
-------------------------------------

Unfortunately I get this error :
java.net.SocketException: Software caused connection abort: socket write
error
        at java.net.SocketOutputStream.socketWrite0(Native Method)
        at
java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
        at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
        at java.io.BufferedOutputStream.write(BufferedOutputStream.java:105)
        at java.io.FilterOutputStream.write(FilterOutputStream.java:80)
        at
org.apache.commons.httpclient.WireLogOutputStream.write(WireLogOutputStream.java:86)
        at
org.apache.commons.httpclient.methods.InputStreamRequestEntity.writeRequest(InputStreamRequestEntity.java:175)
        at
org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequestBody(EntityEnclosingMethod.java:499)
        at
org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:2114)
        at
org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1096)
        at
org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)
        at
org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
        at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
        at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
        at javaapplication1.HttpClt.myPost(HttpClt.java:79)
        at javaapplication1.Main.main(Main.java:42)

Thanks for your help.
Regards

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message