W3C home > Mailing lists > Public > www-jigsaw@w3.org > January to February 2002

HELP!! HTTPClient - problem with PUT from HTTPConnection

From: Nithya Veluswamy <nithya.lakshmi@oracle.com>
Date: Thu, 21 Feb 2002 07:44:15 -0500 (EST)
Message-ID: <3C74EA4F.231C6B8C@oracle.com>
To: www-jigsaw@w3.org, www-talk@w3.org, WEBDAV mailing list <www-webdav-dasl@w3.org>
Hi!
  I am developing a WebDAV Client which PUT's a file into a WebDAV
enabled server. I try putting a file into a non-existent URI
(collection), the program hangs when I try to read the response. (Which
is supposed to be 409 - conflict, when tested on an Internal server). I
am at loss to understand why this happens.
Here is a piece of my code


       {
        HTTPConnection m_HTTPConnection=new
HTTPConnection("www.myhost.com/WebDAV/");
        m_HTTPConnection.setCurrentProxy("www.myProxyHost.com",80);

        HttpOutputStream dos = new HttpOutputStream();
        NVPair header[] = new NVPair[2];
        header[0] = new NVPair("Content-Type",m_ContentType);
        header[1] = new NVPair("Authorization", "Basic " +
m_userPassword);


       HTTPResponse m_resp= m_HTTPConnection.Put(m_UrlObj.getFile(),
dos, header);

       // Reading from a local file and writing into HttpOutputStream
dos.write(bytearr);
        dos.close();

       /*               THIS IS WHERE MY PROGRAM HANGS            */

        int rescode = m_resp.getStatusCode();
        System.out.println("RESPONSE :
"+m_resp.getStatusCode()+m_resp.getReasonLine());

/*--------  */

        // Message 409 Implies Invalid state of resource, Attempting to
create the non existent collection specified by client
        if(rescode==409)   return(makeColl(SrURL,m_HTTPConnection));
       HTTPConnection.stop();

       }

         However, If I try to put into a collection that already exists,
I dont have any problems. There is some connection that is still kept
alive even though I explicitly close the connection. My program never
finishes execution, However I dont get this problem with an Internal
Local server, which I access through a proxy.

Looks like I am majorly missing something! I am using the HTTPClient
package from http://www.innovation.ch/java/HTTPClient/
HELP!
and Thanks!
Nithya
Received on Thursday, 21 February 2002 07:58:43 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 9 April 2012 12:13:36 GMT