NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Error using webdavresource class

 
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users
View previous topic :: View next topic  
Author Message
sanocli



Joined: 06 Apr 2009
Posts: 13

PostPosted: Tue Apr 21, 2009 1:30 pm    Post subject: Error using webdavresource class Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo