Hi,
I don't understand why it doesn't work. I try many examples (for example in
a previous message with put method).
HttpClient client = new HttpClient();
Credentials credentials = new NTCredentials("user", "pwd", "homecomputer ",
"WORKGROUP");
HttpState state = client.getState();
state.setCredentials(null, null, credentials);
PostMethod httppost = new PostMethod("http://computer_name/webdav_acces"); //
Is it the good path ?????????????????????????????
File file = new File("c:\\temp\\my_pdf.pdf");
httppost.setRequestEntity(new InputStreamRequestEntity(new
FileInputStream(file), file.length()));
// httppost.setContentChunked(true);
client.executeMethod(httppost);
With this code I get this error :
org.apache.commons.httpclient.ProtocolException: Unbuffered entity enclosing
request can not be repeated.
at
org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequestBody(EntityEnclosingMethod.java:487)
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:94)
at javaapplication1.Main.main(Main.java:42)
Thanks in advance,
Regards.
Yannick