Home
english
Home
.NET Server
Java Server
.NET Client
AJAX Client
AJAX Browser
Map Drive
Pricing
Contacts
info@ithit.com



AJAX File Browser Request Pipeline

The IT Hit WebDAV AJAX library, that IT Hit AJAX File Browser is built on, provides events that fire when sending data to server and when data is available on a client side. In this event handlers you can change any data submitted between client and server.

Modifying Data Before Sending Request

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:

function onBeforeRequestSend(requestData){
    // HTTP method and URL
    oTD.value += requestData.Method + ' ' + requestData.Href;

    // headers
    for(var header in requestData.Headers){
        oTD.value += '\n' + header + ': ' +  requestData.Headers[header];
    }

    // request body
    oTD.value += '\n' + requestData.Body + '\n';
}

 

...

 

var ajaxFileBrowser = new  ITHit.WebDAV.Client.AjaxFileBrowser.Controller('AjaxFileBrowserContainer', 'http://webdavserver.com/', 'height: 500px; width: 500px');
ITHit.Events.AddListener(ajaxFileBrowser.GetSession(), 'OnBeforeRequestSend', onBeforeRequestSend);

In your event handler you can change the URL and verb, modify any headers and update the request body.

Tunneling

Tunneling is required if you would like to submit all requests using only GET and POST verbs only and avoid using WebDAV-specific verbs such as PROPFIND, PROPRATCH, OPTIONS, REPORT, etc.

To configure tunneling attach your OnBeforeRequestSend handler and change HTTP method name to GET (or any other verb). The original verb is usually passed to server as a custom header:

function onBeforeRequestSend(requestData){
    requestData.Headers['Method'] = requestData.Method;
    requestData.Method = 'GET';
}

Note that your WebDAV server must support tunneling, IT Hit WebDAv Server Engine does not support tunneling by default.

Microsoft Office requires full WebDAV Class 2 support, it would not work with tunneling.

Modifying Data After Receiving Response

The OnResponse event fires when the data is received from server. In your event handler you can update any data received from server.

function onResponse(responceData) {

    // get HTTP method and URL
    oTD.value += '\n\n' + responceData.Status + ' ' + responceData.StatusDescription;
    // get headers
    for (var header in responceData.Headers) {
        oTD.value += '\n' + header + ': ' + responceData.Headers[header];
    }
    // get request body
    oTD.value += '\n' + responceData.BodyText + '\n-----';
}

 

...

 

ITHit.Events.AddListener(ajaxFileBrowser.GetSession(), 'OnResponse', onResponse);

AJAX File Browser Control Events Demo


What WebDAV software would you like to have?

Selected Customers:
Country: Norway
DnB NOR Group
Country: Finland
Bank of Finland
Country: United Kingdom
Bechtle Direct
Country: Sweden
BT Industries
Country: USA
California Chamber of Commerce
Country: Denmark
Danfoss Group
Country: Denmark
DFDS
Country: USA
Fluke Networks
Country: USA
HNI Corporation
Country: USA
IHS Inc
Country: USA
LandAmerica Financial Group
Country: Canada
Laurentian University
Country: USA
Microsoft
Country: Israel
RADVISION
Country: Ukraine
Raiffeisen Bank
Country: Netherlands
Sanoma Uitgevers
Country: USA
Siemens
Country: Australia
WorkCover NSW
Country: Ukraine
OTP Bank
Country: USA
Intel Corporation
Country: Austria
Austrian Federal Railways
Home .NET Server Java Server .NET Client AJAX Client AJAX Browser Map Drive Pricing Contacts

Updated: Tuesday, March 03, 2009