NetBeans Forums
| View previous topic :: View next topic |
| Author |
Message |
sanocli
Joined: 06 Apr 2009 Posts: 13
|
Posted: Tue Apr 21, 2009 1:30 pm Post subject: Error using webdavresource class |
|
|
Hello,
I'm want to put a file, generated by my application, on a distant webdav server with an https url.
To do this, I have tried this piece of code but the initilasation of a webdavresource fails :
| Code: |
public WebDavConnection(String user, String password, String baseUrl, String rep, String protocol) throws URIException, HttpException, IOException {
String URL = protocol + "://" + baseUrl + "/" + rep;
HttpsURL urls = new HttpsURL(URL);
urls.setUserinfo(user, password);
//urls.setPassword(password);
resource = new WebdavResource(urls);
....
|
The line "new WebdavResource(urls);" generates a httpException.
I have also tried with this piece of code :
| Code: | HttpClient client = new HttpClient();
client.getParams().setAuthenticationPreemptive(true);
Credentials defaultcreds = new UsernamePasswordCredentials(sLogin, sMDP);
client.getState().setCredentials(AuthScope.ANY, defaultcreds);
PutMethod method = new PutMethod(sURL);
NewDis ndis = new NewDis();
File src = ndis.getFile();
FileInputStream is = new FileInputStream(src);
InputStreamRequestEntity requestEntity = new InputStreamRequestEntity(is);
method.setRequestEntity(requestEntity);
client.executeMethod(method);
System.out.println(method.getStatusCode() + " " + method.getStatusText()); |
This print 409 conflict.
Any help is apreciate.
Thank you.
Sanocli. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|