new ITHit.WebDAV.Client.WebDavSession()
WebDavSessionFires:
- ITHit.WebDAV.Client.WebDavSession#event:OnBeforeRequestSend
- ITHit.WebDAV.Client.WebDavSession#event:OnResponse
Example
<!DOCTYPE html>
<html lang="en">
<head>
<title>IT Hit WebDAV Ajax Library</title>
<script src="http://www.ajaxbrowser.com/ITHitService/WebDAVAJAXLibrary/ITHitWebDAVClient.js" type="text/javascript"></script>
<script type="text/javascript">
var sFolderUrl = 'http://localhost:35829/';
var oSession = new ITHit.WebDAV.Client.WebDavSession();
oSession.OpenFolderAsync(sFolderUrl, null, function (oFolderAsyncResult) {
if (!oFolderAsyncResult.IsSuccess) {
console.error(oFolderAsyncResult.Error);
return;
}
/** @typedef {ITHit.WebDAV.Client.Folder} oFolder */
var oFolder = oFolderAsyncResult.Result;
console.log(oFolder.Href);
oFolder.GetChildrenAsync(false, null, function (oAsyncResult) {
if (!oAsyncResult.IsSuccess) {
console.error(oFolderAsyncResult.Error);
return;
}
/** @typedef {ITHit.WebDAV.Client.HierarchyItem[]} aHierarchyItems */
var aHierarchyItems = oAsyncResult.Result;
for (var i = 0, l = aHierarchyItems.length; i < l; i++) {
var sSize = aHierarchyItems[i].ResourceType !== ITHit.WebDAV.Client.ResourceType.Folder ?
Math.round(aHierarchyItems[i].ContentLength / 1000) + ' Kb' :
null;
console.log(' [' + aHierarchyItems[i].ResourceType + '] ' + aHierarchyItems[i].DisplayName + (sSize ? ', ' + sSize : ''));
}
});
});
</script>
</head>
<body>
</body>
</html>
Members
-
static ITHit.WebDAV.Client.WebDavSession.ProtocolVersion
ProtocolVersion -
Protocol Version of AJAX Library
-
static ITHit.WebDAV.Client.WebDavSession.Version :string
Version -
Version of AJAX Library
Methods
-
AddListener(sEventName, fCallback, oContext)
AddListener -
Name Type Description sEventNamestring fCallbackfunction oContextobject optional -
CreateFolderAsync(sPath, aProperties, fCallback)
CreateFolderAsync -
Creates folder corresponding to path.
Name Type Description sPathstring Path to the resource. aPropertiesArray.<ITHit.WebDAV.Client.PropertyName> Additional properties requested from server. Default is empty array. fCallbackITHit.WebDAV.Client.WebDavSession~CreateFolderAsyncCallback Function to call when operation is completed. -
OpenFileAsync(sPath, aProperties, fCallback) → {ITHit.WebDAV.Client.Request}
OpenFileAsync -
Load File object corresponding to path.
Name Type Description sPathstring Path to the file. aPropertiesArray.<ITHit.WebDAV.Client.PropertyName> Additional properties requested from server. Default is empty array. fCallbackITHit.WebDAV.Client.WebDavSession~OpenFileAsyncCallback Function to call when operation is completed. Returns:
ITHit.WebDAV.Client.Request Request object. -
OpenFolderAsync(sPath, aProperties, fCallback)
OpenFolderAsync -
Returns Folder object corresponding to path.
Name Type Description sPathstring Path to the folder. aPropertiesArray.<ITHit.WebDAV.Client.PropertyName> Additional properties requested from server. Default is empty array. fCallbackITHit.WebDAV.Client.WebDavSession~OpenFolderAsyncCallback Function to call when operation is completed. Examples
-
OpenItemAsync(sPath, aProperties, fCallback)
OpenItemAsync -
Returns HierarchyItem object corresponding to path.
Name Type Description sPathstring Path to the resource. aPropertiesArray.<ITHit.WebDAV.Client.PropertyName> Additional properties requested from server. Default is empty array. fCallbackITHit.WebDAV.Client.WebDavSession~OpenItemAsyncCallback Function to call when operation is completed. -
RemoveListener(sEventName, fCallback, oContext)
RemoveListener -
Name Type Description sEventNamestring fCallbackfunction oContextobject optional
Type Definitions
-
CreateFolderAsyncCallback(oResult)
CreateFolderAsyncCallback -
Callback function to be called when folder creates on server.
Name Type Description oResultITHit.WebDAV.Client.AsyncResult Result object Name Type Description ResultITHit.WebDAV.Client.HierarchyItem Item corresponding to requested path. -
OpenFileAsyncCallback(oResult)
OpenFileAsyncCallback -
Callback function to be called when file loaded from server.
Name Type Description oResultITHit.WebDAV.Client.AsyncResult Result object Name Type Description ResultITHit.WebDAV.Client.File File corresponding to requested path. -
OpenFolderAsyncCallback(oResult)
OpenFolderAsyncCallback -
Callback function to be called when folder loaded from server.
Name Type Description oResultITHit.WebDAV.Client.AsyncResult Result object Name Type Description ResultITHit.WebDAV.Client.Folder Folder corresponding to requested path. -
OpenItemAsyncCallback(oResult)
OpenItemAsyncCallback -
Callback function to be called when items loaded from server.
Name Type Description oResultITHit.WebDAV.Client.AsyncResult Result object Name Type Description ResultITHit.WebDAV.Client.HierarchyItem Item corresponding to requested path.
Events
-
OnBeforeRequestSend
OnBeforeRequestSend -
The OnBeforeRequestSend event is fired before request is being submitted to server and provides all information that is used when creating the request such as URL, HTTP verb, headers and request body.
Properties:
Name Type Description Methodstring Request method Hrefstring Request absolute path Headersobject Key-value object with headers Bodystring Request Body Examples
-
OnResponse
OnResponse -
The OnResponse event fires when the data is received from server. In your event handler you can update any data received from server.
Properties:
Name Type Description Statusnumber Response status code StatusDescriptionstring Response status description Headersobject Key-value object with headers Bodystring Response Body Examples