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



Creating a Custom Engine Method Handler

Below we will describe how to create a handler to display a custom page in response to GET request sent to a folder.

If user types WebDAV server path in a browser address bar and hits Go the browser will display 405, "Method Not Allowed" page (for Internet Explorer) or the empty page (for Firefox and Opera). The browser actually submits GET request to a WebDAV folder. The GET requests submitted to folder items are not regulated by WebDAV protocol and the Engine V1 always returned 405, "Method Not Allowed" in this case. In Engine V2 you can create a method handler and return custom HTML page.

The Engine V2 provides IMethodHandler interface that must be implemented by your custom handler and passed to Engine.RegisterMethodHandler method. The RegisterMethodHandler will return the original method handler. It can be saved and called later from your custom handler if necessary:

MyCustomGetHandler handler = new MyCustomGetHandler();

handler.OriginalHandler = engine.RegisterMethodHandler("GET", handler);

 

engine.Run(request, response);

...

 

class MyCustomGetHandler : IMethodHandler

{

    private IMethodHandler originalHandler;

 

    public IMethodHandler OriginalHandler

    {

        set { originalHandler = value; }

    }

 

    public void ProcessRequest(Request request, IResponse response, IHierarchyItem item)

    {

        if(item is IFolder)

            HttpContext.Current.Response.TransmitFile(HttpContext.Current.Request.PhysicalApplicationPath + "MyCustomHandlerPage.html");

        else

            originalHandler.ProcessRequest(request, response, item);

    }

}

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
Have a question
about API?
Ask on StackOverflow


Found a bug or have a confidential question?
Write to info@ithit.com
Home .NET Server Java Server .NET Client AJAX Client AJAX Browser Map Drive Pricing Contacts

Updated: Monday, February 16, 2009