1 23 24 package org.apache.slide.webdav.method; 25 26 import java.io.IOException ; 27 28 import org.apache.slide.common.NamespaceAccessToken; 29 import org.apache.slide.common.ServiceAccessException; 30 import org.apache.slide.webdav.WebdavException; 31 import org.apache.slide.webdav.WebdavServletConfig; 32 import org.apache.slide.webdav.util.DeltavConstants; 33 import org.apache.slide.webdav.util.PreconditionViolationException; 34 import org.apache.slide.webdav.util.VersioningHelper; 35 import org.apache.slide.webdav.util.WebdavStatus; 36 37 38 42 public class MkworkspaceMethod extends AbstractWebdavMethod 43 implements DeltavConstants, WriteMethod { 44 45 48 private String resourcePath; 49 50 51 53 54 60 public MkworkspaceMethod(NamespaceAccessToken token, 61 WebdavServletConfig config) { 62 super(token, config); 63 } 64 65 70 protected void parseRequest() throws WebdavException { 71 resourcePath = requestUri; 72 if (resourcePath == null) { 73 resourcePath = "/"; 74 } 75 } 76 77 82 protected void executeRequest() throws WebdavException, IOException { 83 84 slideToken.setForceStoreEnlistment(true); 86 87 try { 89 if (isLockNull(resourcePath)) { 90 int statusCode = WebdavStatus.SC_NOT_FOUND; 91 sendError( statusCode, "lock-null resource", new Object []{resourcePath} ); 92 throw new WebdavException( statusCode ); 93 } 94 } 95 catch (ServiceAccessException e) { 96 int statusCode = getErrorCode((Exception )e); 97 sendError( statusCode, e ); 98 throw new WebdavException( statusCode ); 99 } 100 101 try { 102 VersioningHelper vh = VersioningHelper.getVersioningHelper( 103 slideToken, token, req, resp, getConfig() ); 104 vh.mkworkspace( resourcePath ); 105 } 106 catch (PreconditionViolationException e) { 107 sendPreconditionViolation(e); 108 throw e; 109 } 110 catch (Exception e) { 111 int statusCode = getErrorCode( e ); 112 sendError( statusCode, e ); 113 throw new WebdavException( statusCode ); 114 } 115 finally { 116 resp.setHeader(H_CACHE_CONTROL, NO_CACHE); 117 } 118 } 119 120 } 121 122 | Popular Tags |