diff --git a/lib/server/v2/webDAVServer/WebDAVServer.d.ts b/lib/server/v2/webDAVServer/WebDAVServer.d.ts index 171d36f1..f8b42f6b 100644 --- a/lib/server/v2/webDAVServer/WebDAVServer.d.ts +++ b/lib/server/v2/webDAVServer/WebDAVServer.d.ts @@ -1,8 +1,9 @@ /// import { WebDAVServerOptions } from '../WebDAVServerOptions'; -import { RequestContext, HTTPMethod } from '../WebDAVRequest'; +import { RequestContext, RequestContextExternalOptions } from '../RequestContext'; +import { HTTPMethod } from '../WebDAVRequest'; import { HTTPAuthentication } from '../../../user/v2/authentication/HTTPAuthentication'; -import { IPrivilegeManager } from '../../../user/v2/privilege/IPrivilegeManager'; +import { PrivilegeManager } from '../../../user/v2/privilege/PrivilegeManager'; import { FileSystem } from '../../../manager/v2/fileSystem/FileSystem'; import { ReturnCallback } from '../../../manager/v2/fileSystem/CommonTypes'; import { Resource } from '../../../manager/v2/fileSystem/Resource'; @@ -15,7 +16,7 @@ import * as http from 'http'; export declare type WebDAVServerStartCallback = (server?: http.Server) => void; export declare class WebDAVServer { httpAuthentication: HTTPAuthentication; - privilegeManager: IPrivilegeManager; + privilegeManager: PrivilegeManager; options: WebDAVServerOptions; methods: { [methodName: string]: HTTPMethod; @@ -28,6 +29,10 @@ export declare class WebDAVServer { [path: string]: FileSystem; }; constructor(options?: WebDAVServerOptions); + createExternalContext(): RequestContext; + createExternalContext(callback: (error: Error, ctx: RequestContext) => void): RequestContext; + createExternalContext(options: RequestContextExternalOptions): RequestContext; + createExternalContext(options: RequestContextExternalOptions, callback: (error: Error, ctx: RequestContext) => void): RequestContext; rootFileSystem(): FileSystem; getResource(ctx: RequestContext, path: Path | string, callback: ReturnCallback): void; setFileSystem(path: Path | string, fs: FileSystem, callback: (successed?: boolean) => void): void; diff --git a/lib/server/v2/webDAVServer/WebDAVServer.js b/lib/server/v2/webDAVServer/WebDAVServer.js index 06b81919..bc362931 100644 --- a/lib/server/v2/webDAVServer/WebDAVServer.js +++ b/lib/server/v2/webDAVServer/WebDAVServer.js @@ -1,6 +1,7 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var WebDAVServerOptions_1 = require("../WebDAVServerOptions"); +var RequestContext_1 = require("../RequestContext"); var Commands_1 = require("../commands/Commands"); var Path_1 = require("../../../manager/v2/Path"); var persistence = require("./Persistence"); @@ -30,6 +31,9 @@ var WebDAVServer = (function () { else this.method(k, new commands[k]()); } + WebDAVServer.prototype.createExternalContext = function (_options, _callback) { + return RequestContext_1.RequestContext.createExternal(this, _options, _callback); + }; WebDAVServer.prototype.rootFileSystem = function () { return this.fileSystems['/']; }; diff --git a/src/server/v2/webDAVServer/WebDAVServer.ts b/src/server/v2/webDAVServer/WebDAVServer.ts index 14b25035..87e8ab04 100644 --- a/src/server/v2/webDAVServer/WebDAVServer.ts +++ b/src/server/v2/webDAVServer/WebDAVServer.ts @@ -1,7 +1,8 @@ import { WebDAVServerOptions, setDefaultServerOptions } from '../WebDAVServerOptions' -import { HTTPCodes, RequestContext, HTTPMethod } from '../WebDAVRequest' +import { RequestContext, RequestContextExternalOptions } from '../RequestContext' +import { HTTPCodes, HTTPMethod } from '../WebDAVRequest' import { HTTPAuthentication } from '../../../user/v2/authentication/HTTPAuthentication' -import { IPrivilegeManager } from '../../../user/v2/privilege/IPrivilegeManager' +import { PrivilegeManager } from '../../../user/v2/privilege/PrivilegeManager' import { FileSystem } from '../../../manager/v2/fileSystem/FileSystem' import { ReturnCallback } from '../../../manager/v2/fileSystem/CommonTypes' import { Resource } from '../../../manager/v2/fileSystem/Resource' @@ -21,7 +22,7 @@ export type WebDAVServerStartCallback = (server ?: http.Server) => void; export class WebDAVServer { public httpAuthentication : HTTPAuthentication - public privilegeManager : IPrivilegeManager + public privilegeManager : PrivilegeManager public options : WebDAVServerOptions public methods : { [methodName : string]: HTTPMethod } @@ -56,6 +57,14 @@ export class WebDAVServer this.method(k, new commands[k]()); } + createExternalContext() : RequestContext + createExternalContext(callback : (error : Error, ctx : RequestContext) => void) : RequestContext + createExternalContext(options : RequestContextExternalOptions) : RequestContext + createExternalContext(options : RequestContextExternalOptions, callback : (error : Error, ctx : RequestContext) => void) : RequestContext + createExternalContext(_options ?: RequestContextExternalOptions | ((error : Error, ctx : RequestContext) => void), _callback ?: (error : Error, ctx : RequestContext) => void) : RequestContext + { + return RequestContext.createExternal(this, _options, _callback); + } rootFileSystem() : FileSystem {