1 17 package org.alfresco.repo.webdav; 18 19 import java.util.List ; 20 21 import javax.servlet.http.HttpServletResponse ; 22 23 import org.alfresco.service.cmr.model.FileFolderService; 24 import org.alfresco.service.cmr.model.FileInfo; 25 import org.alfresco.service.cmr.model.FileNotFoundException; 26 import org.alfresco.service.cmr.repository.NodeRef; 27 28 33 public class DeleteMethod extends WebDAVMethod 34 { 35 38 public DeleteMethod() 39 { 40 } 41 42 47 protected void parseRequestHeaders() throws WebDAVServerException 48 { 49 } 51 52 57 protected void parseRequestBody() throws WebDAVServerException 58 { 59 } 61 62 67 protected void executeImpl() throws WebDAVServerException, Exception 68 { 69 if (logger.isDebugEnabled()) 70 { 71 logger.debug("WebDAV DELETE: " + getPath()); 72 } 73 74 FileFolderService fileFolderService = getFileFolderService(); 75 76 NodeRef rootNodeRef = getRootNodeRef(); 77 78 String path = getPath(); 79 List <String > pathElements = getDAVHelper().splitAllPaths(path); 80 FileInfo fileInfo = null; 81 try 82 { 83 fileInfo = fileFolderService.resolveNamePath(rootNodeRef, pathElements); 85 } 86 catch (FileNotFoundException e) 87 { 88 if (logger.isDebugEnabled()) 89 { 90 logger.debug("Node not found: " + getPath()); 91 } 92 throw new WebDAVServerException(HttpServletResponse.SC_NOT_FOUND); 93 } 94 fileFolderService.delete(fileInfo.getNodeRef()); 96 } 97 } 98 | Popular Tags |