/// <summary>
 /// Sets the base path on the disk to the files
 /// </summary>
 /// <param name="rootPath"></param>
 public static void Configure(string rootPath)
 {
     _rootPath         = rootPath;
     _store            = new WebDavDiskStore(rootPath);
     _requestProcessor = new WebDavRequestProcessor(_store);
     _isConfigured     = true;
 }
Example #2
0
        /// <summary>
        /// This constructor uses a Negotiate Listener if one isn't passed.
        ///
        /// Initializes a new instance of the <see cref="WebDavServer" /> class.
        /// </summary>
        /// <param name="store">The
        /// <see cref="IWebDavStore" /> store object that will provide
        /// collections and documents for this
        /// <see cref="WebDavServer" />.</param>
        /// <param name="listener">The
        /// <see cref="IHttpListener" /> object that will handle the web server portion of
        /// the WebDAV server; or
        /// <c>null</c> to use a fresh one.</param>
        /// <param name="methodHandlers">A collection of HTTP method handlers to use by this
        /// <see cref="WebDavServer" />;
        /// or
        /// <c>null</c> to use the built-in method handlers.</param>
        /// <exception cref="System.ArgumentNullException"><para>
        ///   <paramref name="listener" /> is <c>null</c>.</para>
        /// <para>- or -</para>
        /// <para>
        ///   <paramref name="store" /> is <c>null</c>.</para></exception>
        /// <exception cref="System.ArgumentException"><para>
        ///   <paramref name="methodHandlers" /> is empty.</para>
        /// <para>- or -</para>
        /// <para>
        ///   <paramref name="methodHandlers" /> contains a <c>null</c>-reference.</para></exception>
        public WebDavServer(IWebDavStore store, IHttpListener listener = null, IEnumerable <IWebDavMethodHandler> methodHandlers = null)
        {
            if (store == null)
            {
                throw new ArgumentNullException("store");
            }

            if (listener == null)
            {
                listener      = new HttpListenerNegotiateAdapter();
                _ownsListener = true;
            }

            _listener = listener;
            _store    = store;

            _webDavRequestProcessor = new WebDavRequestProcessor(store, methodHandlers);
        }
Example #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="store"></param>
        /// <param name="authtype"></param>
        /// <param name="methodHandlers"></param>
        public WebDavServer(IWebDavStore store, AuthType authtype, IEnumerable <IWebDavMethodHandler> methodHandlers = null)
        {
            _ownsListener = true;
            switch (authtype)
            {
            case AuthType.Basic:
                _listener = new HttpListenerBasicAdapter();
                break;

            case AuthType.Negotiate:
                _listener = new HttpListenerNegotiateAdapter();
                break;

            case AuthType.Anonymous:
                _listener = new HttpListenerAnyonymousAdapter();
                break;
            }

            //_negotiateListener = listener;
            _store = store;

            _webDavRequestProcessor = new WebDavRequestProcessor(store, methodHandlers);
        }