Subject: FW: Re: WebDAV enabled applet example

From: Jim Whitehead <[email-masked]>
Date: Sun, 3 Sep 2000 15:44:10 -0700

-----Original Message-----
From: csamson [mailto:[email-masked]]
Sent: Sunday, September 03, 2000 3:43 PM
To: Jim Whitehead
Cc: [email-masked]
Subject: Re: Re: WebDAV enabled applet example

Thanks to Jim and Kam for the input to my query putting together a Java
Applet
example using WebDAV.

As Jim had suggested the "\r\n" at the end of the PROPFIND command was
terminating
the HTTP request header.  This became apparent when I tested against
sharemation which
returned an error indicating that the Host: command was missing.  The reason
that I
had included the "\r\n" is that this seemed to be needed to get a response
from the
WebDAV servers - I was just putting it in the wrong place !  In practice, as
Kam indicated,
you need a blank line containing at least one space - and this needs to be
followed by
"\r\n".

i.e. the main pieces of Java code to access a file stored on mydocsonline
are :

       URL url=new URL("http://webfolders.mydocsonline.com/rfc2518.htm");
        .........

        // input and output streams
        InputStream from_server=socket.getInputStream();
        PrintWriter to_server=
          new PrintWriter(new OutputStreamWriter(socket.getOutputStream()));
      ....................

             String query="";
             String userpass="";

{ 
               userpass=base64EncodeString("username:password"); 
             } catch(UnsupportedEncodingException x){ 
             }
             //
             query="<?xml version=\"1.0\" encoding=\"utf-8\"?>"+
            "<D:propfind xmlns:D=\"DAV:\">"+
            "<D:allprop/></D:propfind>";
           //
          to_server.println("PROPFIND " + filename + " HTTP/1.1");
          to_server.println("Host:" +  host); 
          to_server.println("Connection:Keep-Alive"); 
          to_server.println("Content-Length:"+ query.length());
          to_server.println("Content-Type:text/xml");
          to_server.println("Accept-Language:en-us");
          to_server.println("Authorization:Basic " + userpass);
          to_server.println("User-Agent:" +  "Microsoft Data Access Internet Publishing Provider DAV 1.1"); 
          to_server.println("Depth:0");
          to_server.println(" " + "\r\n");    
          this.showStatus("Characters sent:"+ query.length()+ " characters");
          to_server.println(query);
          to_server.flush(); 
             
I've got examples of PROPFIND, LOCK and UNLOCK working with sharemation, but only PROPFIND 
with mydocsonline.  The LOCK returns a message 412 Precondition Failed - although the same code
works with sharemation - Does mydocsonline support locking ?  Looking at the Web interface, there
is no mention of locking.

Regards,

JC Samson

-----Original Message-----
From: Jim Whitehead <[email-masked]>
To: WebDAV WG <[email-masked]>; [email-masked] <[email-masked]>
Date: 28 August 2000 19:14
Subject: FW: Re: WebDAV enabled applet example

Accidentally caught by the spam filter.
 
- Jim
-----Original Message-----
From: Kam Kasravi [mailto:[email-masked]]
Sent: Friday, August 25, 2000 6:29 PM
To: [email-masked]
Subject: [Moderator Action] Re: WebDAV enabled applet example

JC:
 
You also need a space between the last request header and the body of the message.  Also leave off the trailing space on the authorization header. Try:
 
PROPFIND / HTTP/1.1
Connection:Keep-Alive
Conent-length:XXX
Content-type:text/xml
 Accept-language:en-us
 Authorization:Basic YWRtaZ46YWRtaW4=
 Host:webfolders.mydocsonline.com
 User-agent:Microsoft Data Access Internet Publishing Provider DAV 1.1
 Depth:0
 
<?xml version=\"1.0\" encoding=\"utf-8\"?>
<D:propfind xmlns:D=\"DAV:\">
<D:allprop/>
</D:propfind>

 
Kam