UNPKG

ithit.webdav.server

Version:

With IT Hit WebDAV Server Engine for Node.js you can create your own WebDAV server, add WebDAV support to your existing Node.js project or DAV-enable your CMS/DMS/CRM.

53 lines (52 loc) 2.72 kB
/** * @copyright Copyright (c) 2017 IT Hit. All rights reserved. */ import { DavContextBase } from "../DavContextBase"; import { IHierarchyItem } from "../IHierarchyItem"; /** * Represents HTTP method handler. * @remarks * The IT Hit WebDAV Server Engine allows creating custom HTTP handlers and replacing original engine handlers. * To add or replace handler call {@link DavEngine.registerMethodHandler} method passing HTTP method * name and object instance implementing. The original handler, if any, * is returned from {@link DavEngine.registerMethodHandler} method. * * The {@link IMethodHandler.processRequest} method of this interface is called by the engine during {@link DavEngine.run} call. * The hierarchy item returned from {@link DavContextBase.getHierarchyItem} is passed to ProcessRequest * method as a parameter. * * The handler must call {@link DavContextBase.beforeResponse} when all update methods have been called and * the handler is about * to start writing response. */ export interface IMethodHandler { /** * Determines whether engine can buffer content to calculate content length. * @returns Boolean indicating whether content shall be buffered to calculated content length. */ enableOutputBuffering: boolean; /** * Determines whether output produces by this handler shall be logged if debug logging is enabled. * @returns Boolean indicating whether output shall be logged in debug mode. */ enableOutputDebugLogging: boolean; /** * Determines whether input read by this handler shall be logged if debug logging is enabled. * @returns Boolean indicating whether input shall be logged in debug mode. */ enableInputDebugLogging: boolean; /** * Enables processing of HTTP Web requests by a custom handler. * @param context Instance of your context class derived from {@link DavContextBase} class. * @param item Hierarchy item returned from {@link DavContextBase.getHierarchyItem} or null. * @remarks The {@link IMethodHandler.processRequest} method is called by the engine during {@link DavEngine.run} * call. The hierarchy item returned from {@link DavContextBase.getHierarchyItem} is * passed to this method. If {@link DavContextBase.getHierarchyItem} returns null the null is passed. */ processRequest(context: DavContextBase, item: IHierarchyItem): void; /** * Determines whether this method shall be enlisted in 'supported-method-set' for item. * @param item Hierarchy item returned from {@link DavContextBase.getHierarchyItem} or null. */ appliesTo(item: IHierarchyItem): boolean; }