12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- using System.Collections.Generic;
- using Mtp2Dav.WebDAVSharp.Server._1d2086a502937936ebc6bfe19cfa15d855be1c31.Adapters;
- using Mtp2Dav.WebDAVSharp.Server._1d2086a502937936ebc6bfe19cfa15d855be1c31.Stores;
- namespace Mtp2Dav.WebDAVSharp.Server._1d2086a502937936ebc6bfe19cfa15d855be1c31.MethodHandlers
- {
- /// <summary>
- /// This class implements the <c>DELETE</c> HTTP method for WebDAV#.
- /// </summary>
- internal class WebDavDeleteMethodHandler : WebDavMethodHandlerBase, IWebDavMethodHandler
- {
- /// <summary>
- /// Gets the collection of the names of the HTTP methods handled by this instance.
- /// </summary>
- /// <value>
- /// The names.
- /// </value>
- public IEnumerable<string> Names => new[]
- {
- "DELETE"
- };
- /// <summary>
- /// Processes the request.
- /// </summary>
- /// <param name="server">The <see cref="WebDavServer" /> through which the request came in from the client.</param>
- /// <param name="context">
- /// The
- /// <see cref="IHttpListenerContext" /> object containing both the request and response
- /// objects to use.
- /// </param>
- /// <param name="store">The <see cref="IWebDavStore" /> that the <see cref="WebDavServer" /> is hosting.</param>
- public void ProcessRequest(WebDavServer server, IHttpListenerContext context, IWebDavStore store)
- {
- // Get the parent collection of the item
- var collection = GetParentCollection(server, store, context.Request.Url);
- // Get the item from the collection
- var item = GetItemFromCollection(collection, context.Request.Url);
- // Deletes the item
- collection.Delete(item);
- context.SendSimpleResponse();
- }
- }
- }
|