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 status and description
    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

comments powered by Disqus

Selected Customers:
USA
Symantec
Country: Sweden
Toyota
Country: USA
Microsoft
Country: Ukraine
Raiffeisen Bank
Country: USA
Siemens
Country: USA
Lockheed Martin
Country: USA
Intel Corporation
Country: Germany
SAP AG
Country: Israel
Autodesk, Inc.
Country: USA
U.S. Customs and Border Protection Agency
Home .NET Server Java Server .NET Client AJAX Client AJAX Browser Map Drive Pricing Contacts

Updated: Friday, September 16, 2011