Click or drag to resize

DavEngineAsync Class

IT Hit WebDAV Classes Reference
The DavEngine class provides the core implementation for WebDAV engine.
Inheritance Hierarchy

Namespace:  ITHit.WebDAV.Server
Assembly:  ITHit.WebDAV.Server (in ITHit.WebDAV.Server.dll) Version: 7.1.4620
public class DavEngineAsync

The DavEngineAsync type exposes the following members.

Public methodDavEngineAsync
Initializes a new instance of the DavEngine class.
Public propertyAutoPutUnderVersionControl
Determines if placing file under version control is automatic.
Public propertyCalculateContentLength
Indicates if response content length is calculated. Default is true.
Public propertyContentEncoding
Gets or sets the HTTP character set of the output stream. Default is UTF-8.
Public propertyCorsAllowedFor
Enables or disables CORS.
Public propertyCode exampleLicense
Gets or sets the license text.
Public propertyLogger
ILogger instance which engine will use for logging.
Public propertyOutputXmlFormatting
Specifies whether XML written to the output will be formatted. Default is false.
Public propertyUseFullUris
Specifies whether engine shall use full or relative urls. Default is true.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodCode exampleRegisterMethodHandler
Registers custom method handler.
Public methodRegisterOptionsHandler
Registers custom options handler.
Public methodRegisterPropertyHandler
Registers custom property handler.
Public methodRegisterReportHandler
Registers custom report handler.
Public methodCode exampleRunAsync
Processes WebDAV request and generates WebDAV response.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)

Engine parses XML send by WebDAV client, processes requests making calls to your implementations of WebDAV interfaces (IHierarchyItemAsync, IFolderAsync, IFileAsync and other) and finally generates XML response.

In each HTTP request you will create a separate instance of your class derived from DavContextBaseAsync class and pass it to the RunAsync(DavContextBaseAsync) method. Via the context, engine receives all necessary information about hosting environment.

You must set License property before you can use the engine.

All updates invoked within one request execution shall be inside a single transaction. Transaction can be committed or rollbacked in BeforeResponseAsync method, which is called right before starting sending response to the client. After this method is called, no methods of interfaces which update state will be called. However methods which read state can be called.


HttpListener-based server:

class Program
    static void Main(string[] args)
        HttpListener listener = new HttpListener();
        DavEngine engine = new DavEngine();
        engine.License = "..."; 
        while (true)
            HttpListenerContext context = listener.GetContext();
            engine.Run(new MyContext(context, listener.Prefixes));
                // client closed connection before the content was sent
Thread Safety
Method RunAsync(DavContextBaseAsync) is threadsafe. All other members are not threadsafe. You can create a single instance of DavEngine, initialize it onces and use to serve all requests from different threads.
See Also