Class nl.sara.webdav.Client
Connection to a WebDAV server
Defined in: client.js.
Constructor Attributes | Constructor Name and Description |
---|---|
nl.sara.webdav.Client(config, useHTTPS, port, defaultHeaders)
|
Method Attributes | Method Name and Description |
---|---|
acl(path, callback, acl, headers)
Perform a WebDAV ACL request
|
|
<static> |
nl.sara.webdav.Client.ajaxHandler(ajax, callback)
AJAX request handler.
|
copy(path, callback, destination, overwriteMode, depth, headers)
Perform a WebDAV COPY request
|
|
get(path, callback, headers)
Perform a WebDAV GET request
|
|
getAjax(method, url, callback, headers)
Prepares a XMLHttpRequest object to be used for an AJAX request
|
|
getUrl(path)
Converts a path to the full url (i.e.
|
|
head(path, callback, headers)
Perform a WebDAV HEAD request
|
|
lock(path, callback, headers)
Perform a WebDAV LOCK request
|
|
mkcol(path, callback, body, contenttype, headers)
Perform a WebDAV MKCOL request
|
|
move(path, callback, destination, overwriteMode, headers)
Perform a WebDAV MOVE request
|
|
post(path, callback, body, contenttype, headers)
Perform a WebDAV POST request
|
|
propfind(path, callback, depth, props, include, headers)
Perform a WebDAV PROPFIND request
|
|
proppatch(path, callback, setProps, delProps, headers)
Perform a WebDAV PROPPATCH request
|
|
put(path, callback, body, contenttype, headers)
Perform a WebDAV PUT request
|
|
remove(path, callback, headers)
Perform a WebDAV DELETE request
Because 'delete' is an operator in JavaScript, I had to name this method
'remove'.
|
|
report(path, callback, body, headers)
Perform a WebDAV REPORT request
|
|
unlock(path, callback, headers)
Perform a WebDAV UNLOCK request
|
Class Detail
nl.sara.webdav.Client(config, useHTTPS, port, defaultHeaders)
- Parameters:
- {Array} config Optional
- A configuration object. It can contain the following fields: - host; String containing the hostname to connect to (default: current host) - useHTTPS; If set to (boolean) false, a regular HTTP connection will be used, any other value (even 0 or '' which evaluate to false) and HTTPS will be used instead. Is ignored if host is not set. (default: true) - port; Integer with the port number to use. Is ignored if host is not set. (default: 443 for HTTPS and 80 for HTTP) - defaultHeaders; An array containing default headers to use for each request. Header names should be the keys. (default: {} i.e. no default headers) - username; A string with the username to use for authentication. (default: the current username if any) - password; A string with the password to use for authentication. This is only used if a username is supplied. (default: the current password if any) For backwards compatibility reasons, it is also possible to specify the 'host', 'useHTTPS', 'port' and 'defaultHeaders' as regular parameters (in that order). Note that useHTTPS works differently in that case; any other value than boolean True will result in regular HTTP. If you want to supply a username and password, you will have to use the config array, you cannot pass them as extra normal parameters.
- useHTTPS
- port
- defaultHeaders
Method Detail
{nl.sara.webdav.Client}
acl(path, callback, acl, headers)
Perform a WebDAV ACL request
Defined in: client_acl.js.
Defined in: client_acl.js.
- Parameters:
- {String} path
- The path to perform ACL on
- {Function(status|body|headers)} callback
- Querying the server is done asynchronously, this callback function is called when the results are in
- {nl.sara.webdav.Acl} acl
- The ACL to submit
- {Array} headers
- Optional; Additional headers to set
- Returns:
- {nl.sara.webdav.Client} The client itself for chaining methods
<static>
{void}
nl.sara.webdav.Client.ajaxHandler(ajax, callback)
AJAX request handler. Parses Multistatus (if available) and call a user specified callback function
- Parameters:
- {XMLHttpRequest} ajax
- The XMLHttpRequest object which performed the request
- {Function(status|body|headers)} callback
- Querying the server is done asynchronously, this callback function is called when the results are in
- Returns:
- {void}
{nl.sara.webdav.Client}
copy(path, callback, destination, overwriteMode, depth, headers)
Perform a WebDAV COPY request
- Parameters:
- {String} path
- The path to perform COPY on
- {Function(status|body|headers)} callback
- Querying the server is done asynchronously, this callback function is called when the results are in
- {String} destination
- The destination to copy to. Should be either a full URL or a path from the root on this server (i.e. it should start with a /)
- {Integer} overwriteMode Optional, Default: SILENT_OVERWRITE
- Optional; Specify what to do when destination resource already exists. Should be either FAIL_ON_OVERWRITE or SILENT_OVERWRITE. The default is SILENT_OVERWRITE.
- {String} depth Optional
- Optional; Should be '0' or 'infinity'. This is used in case of a collection; 0 means only copy the collection itself, infinity means copy also everything contained in the collection
- {Array} headers
- Optional; Additional headers to set
- Returns:
- {nl.sara.webdav.Client} The client itself for chaining methods
{nl.sara.webdav.Client}
get(path, callback, headers)
Perform a WebDAV GET request
- Parameters:
- {String} path
- The path to GET
- {Function(status|content)} callback
- Querying the server is done asynchronously, this callback function is called when the results are in
- {Array} headers
- Optional; Additional headers to set
- Returns:
- {nl.sara.webdav.Client} The client itself for chaining methods
{XMLHttpRequest}
getAjax(method, url, callback, headers)
Prepares a XMLHttpRequest object to be used for an AJAX request
- Parameters:
- {String} method
- The HTTP/webDAV method to use (e.g. GET, POST, PROPFIND)
- {String} url
- The url to connect to
- {Function(status|body|headers)} callback
- Querying the server is done asynchronously, this callback function is called when the results are in
- {Array} headers
- Additional headers to set
- Returns:
- {XMLHttpRequest} A prepared XMLHttpRequest
{String}
getUrl(path)
Converts a path to the full url (i.e. appends the protocol and host part)
- Parameters:
- {String} path
- The path on the server
- Returns:
- {String} The full url to the path
{nl.sara.webdav.Client}
head(path, callback, headers)
Perform a WebDAV HEAD request
- Parameters:
- {String} path
- The path to perform HEAD on
- {Function(status|body|headers)} callback
- Querying the server is done asynchronously, this callback function is called when the results are in
- {Array} headers
- Optional; Additional headers to set
- Returns:
- {nl.sara.webdav.Client} The client itself for chaining methods
{nl.sara.webdav.Client}
lock(path, callback, headers)
Perform a WebDAV LOCK request
- Parameters:
- {String} path
- The path to perform LOCK on
- {Function(status|body|headers)} callback
- Querying the server is done asynchronously, this callback function is called when the results are in
- {Array} headers
- Optional; Additional headers to set
- Returns:
- {nl.sara.webdav.Client} The client itself for chaining methods
{nl.sara.webdav.Client}
mkcol(path, callback, body, contenttype, headers)
Perform a WebDAV MKCOL request
- Parameters:
- {String} path
- The path to perform MKCOL on
- {Function(status|body|headers)} callback
- Querying the server is done asynchronously, this callback function is called when the results are in
- {String} body Optional
- Optional; a body to include in the MKCOL request.
- {String} contenttype Optional, Default: 'application/xml; charset="utf-8"'
- Optional; the content type of the body (i.e. value for the Content-Type header). If omitted, but body is specified, then 'application/xml; charset="utf-8"' is assumed
- {Array} headers
- Optional; Additional headers to set
- Returns:
- {nl.sara.webdav.Client} The client itself for chaining methods
{nl.sara.webdav.Client}
move(path, callback, destination, overwriteMode, headers)
Perform a WebDAV MOVE request
- Parameters:
- {String} path
- The path to perform MOVE on
- {Function(status|body|headers)} callback
- Querying the server is done asynchronously, this callback function is called when the results are in
- {String} destination
- The destination to move to. Should be either a full URL or a path from the root on this server (i.e. it should start with a /)
- {Number} overwriteMode Optional, Default: SILENT_OVERWRITE
- Optional; Specify what to do when destination resource already exists. Should be either FAIL_ON_OVERWRITE, TRUNCATE_ON_OVERWRITE or SILENT_OVERWRITE. The default is SILENT_OVERWRITE.
- {Array} headers
- Optional; Additional headers to set
- Returns:
- {nl.sara.webdav.Client} The client itself for chaining methods
{nl.sara.webdav.Client}
post(path, callback, body, contenttype, headers)
Perform a WebDAV POST request
- Parameters:
- {String} path
- The path to perform POST on
- {Function(status|body|headers)} callback
- Querying the server is done asynchronously, this callback function is called when the results are in
- {String} body Optional
- Optional; a body to include in the POST request.
- {String} contenttype Optional, Default: 'application/x-www-form-urlencoded'
- Optional; the content type of the body (i.e. value for the Content-Type header). If omitted, but body is specified, then 'application/x-www-form-urlencoded' is assumed
- {Array} headers
- Optional; Additional headers to set
- Returns:
- {nl.sara.webdav.Client} The client itself for chaining methods
{nl.sara.webdav.Client}
propfind(path, callback, depth, props, include, headers)
Perform a WebDAV PROPFIND request
- Parameters:
- {String} path
- The path get a PROPFIND for
- {Function(status|body|headers)} callback
- Querying the server is done asynchronously, this callback function is called when the results are in
- {String} depth Optional, Default: 0
- Optional; Value for the 'depth' header, should be either '0', '1' or the class constant INFINITY. When omitted, '0' is used. See RFC 4918.
- {mixed} props Optional, Default: ALLPROP
- Optional; The properties to fetch. Should be either one of the class constants PROPNAME or ALLPROP or an array with Property objects. When omitted, ALLPROP is assumed. See RFC 4918.
- {nl.sara.webdav.Property[]} include Optional
- Optional; An array with Property objects used for the
element. This is only used for ALLPROP requests. When omitted, no element is send. See RFC 4918. - {Array} headers
- Optional; Additional headers to set
- Returns:
- {nl.sara.webdav.Client} The client itself for chaining methods
{nl.sara.webdav.Client}
proppatch(path, callback, setProps, delProps, headers)
Perform a WebDAV PROPPATCH request
- Parameters:
- {String} path
- The path do a PROPPATCH on
- {Function(status|body|headers)} callback
- Querying the server is done asynchronously, this callback function is called when the results are in
- {nl.sara.webdav.Property[]} setProps Optional
- Optional; The properties to set. If not set, delProps should be set. Can be omitted with 'undefined'.
- {nl.sara.webdav.Property[]} delProps Optional
- Optional; The properties to delete. If not set, setProps should be set.
- {Array} headers
- Optional; Additional headers to set
- Returns:
- {nl.sara.webdav.Client} The client itself for chaining methods
{nl.sara.webdav.Client}
put(path, callback, body, contenttype, headers)
Perform a WebDAV PUT request
- Parameters:
- {String} path
- The path to perform PUT on
- {Function(status|body|headers)} callback
- Querying the server is done asynchronously, this callback function is called when the results are in
- {String} body
- The content to include in the PUT request.
- {String} contenttype Optional
- Optional; the content type of the body (i.e. value for the Content-Type header).
- {Array} headers
- Optional; Additional headers to set
- Returns:
- {nl.sara.webdav.Client} The client itself for chaining methods
{nl.sara.webdav.Client}
remove(path, callback, headers)
Perform a WebDAV DELETE request
Because 'delete' is an operator in JavaScript, I had to name this method
'remove'. However, performs a regular DELETE request as described in
RFC 4918
- Parameters:
- {String} path
- The path to perform DELETE on
- {Function(status|body|headers)} callback
- Querying the server is done asynchronously, this callback function is called when the results are in
- {Array} headers
- Optional; Additional headers to set
- Returns:
- {nl.sara.webdav.Client} The client itself for chaining methods
{nl.sara.webdav.Client}
report(path, callback, body, headers)
Perform a WebDAV REPORT request
Defined in: client_acl.js.
Defined in: client_acl.js.
- Parameters:
- {String} path
- The path to perform REPORT on
- {Function(status|body|headers)} callback
- Querying the server is done asynchronously, this callback function is called when the results are in
- {Document} body
- The (XML DOM) document to parse and send as the request body
- {Array} headers
- Optional; Additional headers to set
- Returns:
- {nl.sara.webdav.Client} The client itself for chaining methods
{nl.sara.webdav.Client}
unlock(path, callback, headers)
Perform a WebDAV UNLOCK request
- Parameters:
- {String} path
- The path to perform UNLOCK on
- {Function(status|body|headers)} callback
- Querying the server is done asynchronously, this callback function is called when the results are in
- {Array} headers
- Optional; Additional headers to set
- Returns:
- {nl.sara.webdav.Client} The client itself for chaining methods