Skip to content

Commit 9ea4f49

Browse files
committed
Complete README
1 parent 2f00e94 commit 9ea4f49

File tree

1 file changed

+116
-1
lines changed

1 file changed

+116
-1
lines changed

README.md

Lines changed: 116 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,116 @@
1-
# livecode-webdavlib
1+
# livecode-webdavlib
2+
3+
4+
WebDavLib is a LiveCode library for accessing WebDAV servers. it supports Digest and Basic authentication. WebDavLib does not depend on tsNet and can therefore be used with the Community Edition.
5+
6+
##### WebDavLib currently supports the following WebDAV methods:
7+
8+
- OPTIONS
9+
- PROPFIND
10+
- HEAD
11+
- GET
12+
- PUT
13+
- DELETE
14+
- MKCOL
15+
- PROPPATCH
16+
- LOCK
17+
- UNLOCK
18+
19+
20+
##### Examples of tasks the library allows to accomplish:
21+
22+
- Generate a list of all WebDAV methods provided by the server
23+
- Get the file size, modification date, content type etc. of a remote file
24+
- Download a file
25+
- Check write permission of a directory
26+
- Upload a file
27+
- Delete a file / folder
28+
- List files / folders
29+
- Create a folder
30+
- Set custom file properties
31+
- Get custom file properties
32+
- Remove custom file properties
33+
- Lock a file (may be not supported on NextCloud servers)
34+
- Check if a file is locked
35+
- Unlock a file (may be not supported on NextCloud servers)
36+
37+
WebDavLib is tested on a commercial NextCloud server, on a private NextCloud server and on a local WebDAV server.
38+
39+
40+
### Getting Started
41+
42+
Check out the enclosed sample stack "webDavTest". Fill out the form and execute the request handler by choosing a method from the option menu (top to bottom) and clicking on "Request".
43+
44+
45+
### Usage
46+
47+
Basically the procedure to send a WebDAV request involves:
48+
49+
- Setting up the request data using an array
50+
- Storing the request data in WebDavLib which returns a request ID
51+
- Sending the request to the server to receive a response
52+
53+
Following is an example (returning the WebDAV methods the server supports):
54+
55+
```
56+
-- SETUP REQUEST DATA
57+
put fld "hostFld" into tRequestDataA["host"]
58+
put fld "portFld" into tRequestDataA["port"]
59+
put fld "userFld" into tRequestDataA["user"]
60+
put fld "passwordFld" into tRequestDataA["password"]
61+
put the label of btn "authBtn" into tRequestDataA["authType"]
62+
put the hilite of btn "secureBtn" into tRequestDataA["sslFlag"]
63+
put the cAgent of this stack && the version && "(" & the platform & ")" into tRequestDataA["agent"]
64+
put fld "davDirFld" into tRequestDataA["uri"]
65+
put "OPTIONS" into tRequestDataA["method"]
66+
67+
-- STORE REQUEST DATA IN LIBRARY, GET REQUEST ID
68+
wdlSetupNewRequest tRequestDataA
69+
put the result into tReqID
70+
71+
-- SEND REQUEST TO SERVER
72+
put wdlExecute(tReqID) into tServerResponse
73+
74+
wdlCleanup tReqID
75+
```
76+
77+
These are the request data array keys used depending on the particular request method:
78+
79+
- host (the host address like: myname.ocloud.de)
80+
- uri (the path to the WebDAV directory like: /remote.php/webdav/)
81+
- port (as a general rule this is 80 or 443 for secure connections)
82+
- user
83+
- password (user password or app password)
84+
- authType (Basic or Digest)
85+
- sslFlag (a boolean, TRUE for a secure connection)
86+
- method (see the WebDav methods above)
87+
- agent (User-agent)
88+
- propertiesXML (the properties XML data inserted into a XML request body)
89+
- contentType (Content-type like application/xml; charset="utf-8")
90+
- contentLength
91+
- dataToUpload (the binary file data to upload)
92+
- nameSpace (WebDAV XML namespace like http://www.w3.com/standards/z39.50/)
93+
- lockScope (exclusive or shared)
94+
- lockType (write)
95+
- lockOwner (any name)
96+
- lockToken (the cCurrentLockToken of stack "WebDavLib")
97+
- callBack (the name of a callback handler used by methods GET and PUT)
98+
- callbackTarget (the long ID of the object containing the callback handler)
99+
100+
101+
**NOTE:** Be aware that if you use the LC Indy Edition or the LC Business Edition WebDavLib does not work if the tsNet external is loaded. So, to use the WebDavLib library you need to unload tsNetLibURL like:
102+
103+
```
104+
if the environment is "development" and there is a stack "tsNetLibURL" then
105+
dispatch "revUnloadLibrary" to stack "tsNetLibURL"
106+
end if
107+
```
108+
109+
See button "requestBtn" in the enclosed sample stack.
110+
111+
112+
### Meta
113+
114+
- Version: 1.0.0
115+
- Author: [Ralf Bitter](mailto:rabit@revigniter.com)
116+

0 commit comments

Comments
 (0)