1 17 package com.sslexplorer.vfs.webdav.methods; 18 19 import java.io.IOException ; 20 21 import com.sslexplorer.vfs.VFSLockManager; 22 import com.sslexplorer.vfs.VFSResource; 23 import com.sslexplorer.vfs.webdav.DAVException; 24 import com.sslexplorer.vfs.webdav.DAVMethod; 25 import com.sslexplorer.vfs.webdav.DAVTransaction; 26 import com.sslexplorer.vfs.webdav.LockedException; 27 28 36 public class MKCOL implements DAVMethod { 37 38 43 public MKCOL() { 44 super(); 45 } 46 47 52 public void process(DAVTransaction transaction, VFSResource resource) throws LockedException, IOException { 53 54 String handle = VFSLockManager.getNewHandle(); 55 VFSLockManager.getInstance().lock(resource, transaction.getSessionInfo(), true, true, handle); 56 57 try { 58 transaction.setHeader("content-type", "application/octet-stream"); 59 62 if (transaction.getInputStream() != null) 63 throw new DAVException(415, "No request body allowed in request"); 64 65 66 resource.makeCollection(); 67 transaction.setStatus(201); 68 resource.getMount().resourceCollectionCreated(resource, transaction, null); 69 } catch (Exception e) { 70 resource.getMount().resourceCollectionCreated(resource, transaction, e); 71 IOException ioe = new IOException (e.getMessage()); 72 ioe.initCause(e); 73 throw ioe; 74 } finally { 75 VFSLockManager.getInstance().unlock(transaction.getSessionInfo(), handle); 76 } 77 } 78 } | Popular Tags |