/// <summary> /// Processes the request. /// </summary> /// <param name="context">The /// <see cref="IWebDavContext" /> 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(IWebDavContext context, IWebDavStore store) { /*************************************************************************************************** * Send the response ***************************************************************************************************/ WindowsIdentity Identity = (WindowsIdentity)Thread.GetData(Thread.GetNamedDataSlot(Constants.HttpUser)); var statusCode = WebDavStoreItemLock.UnLock(context.Request.Url, GetLockTokenHeader(context.Request), Identity.Name); context.SetStatusCode(statusCode); }
/// <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> /// <param name="response"></param> /// <param name="request"></param> protected override void OnProcessRequest( WebDavServer server, IHttpListenerContext context, IWebDavStore store, XmlDocument request, XmlDocument response) { if (!WebDavStoreItemLock.LockEnabled) { throw new WebDavNotImplementedException("Lock support disabled"); } /*************************************************************************************************** * Send the response ***************************************************************************************************/ WindowsIdentity Identity = (WindowsIdentity)Thread.GetData(Thread.GetNamedDataSlot(WebDavServer.HttpUser)); var unlockResult = WebDavStoreItemLock.UnLock(context.Request.Url, GetLockTokenHeader(context.Request), Identity.Name); IWebDavStoreCollection collection = GetParentCollection(server, store, context.Request.Url); try { var item = GetItemFromCollection(collection, context.Request.Url); if (item != null) { //we already have an item var resourceCanBeUnLocked = item.UnLock(Identity.Name); if (!resourceCanBeUnLocked) { //TODO: decide what to do if the resource cannot be locked. } } } catch (Exception ex) { WebDavServer.Log.Warn( String.Format("Request unlock on a resource that does not exists: {0}", context.Request.Url), ex); } context.SendSimpleResponse(unlockResult); }