/** * MOVE Method. */ protected void doMove(HttpServletRequest req, HttpServletResponse resp) throws IOException { if (readOnly) { resp.sendError(WebdavStatus.SC_FORBIDDEN); return; } if (isLocked(req)) { resp.sendError(WebdavStatus.SC_LOCKED); return; } String path = getRelativePath(req); if (copyResource(req, resp)) { deleteResource(path, req, resp, false); } }
/** * OPTIONS Method. * * @param req The Servlet request * @param resp The Servlet response * @throws ServletException If an error occurs * @throws IOException If an IO error occurs */ @Override protected void doOptions(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { resp.addHeader("DAV", "1,2"); resp.addHeader("Allow", determineMethodsAllowed(req)); resp.addHeader("MS-Author-Via", "DAV"); }
/** * Delete a resource. * * @param req Servlet request * @param resp Servlet response * @return boolean true if the copy is successful */ private boolean deleteResource(HttpServletRequest req, HttpServletResponse resp) throws IOException { String path = getRelativePath(req); return deleteResource(path, req, resp, true); }
/** * DELETE Method. */ protected void doDelete(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { if (readOnly) { resp.sendError(WebdavStatus.SC_FORBIDDEN); return; } if (isLocked(req)) { resp.sendError(WebdavStatus.SC_LOCKED); return; } deleteResource(req, resp); }
/** * Handles the special WebDAV methods. */ protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String method = req.getMethod(); if (debug > 0) { String path = getRelativePath(req); log("[" + method + "] " + path); } if (method.equals(METHOD_PROPFIND)) { doPropfind(req, resp); } else if (method.equals(METHOD_PROPPATCH)) { doProppatch(req, resp); } else if (method.equals(METHOD_MKCOL)) { doMkcol(req, resp); } else if (method.equals(METHOD_COPY)) { doCopy(req, resp); } else if (method.equals(METHOD_MOVE)) { doMove(req, resp); } else if (method.equals(METHOD_LOCK)) { doLock(req, resp); } else if (method.equals(METHOD_UNLOCK)) { doUnlock(req, resp); } else { // DefaultServlet processing super.service(req, resp); } }
if (isLocked(req)) { resp.sendError(WebdavStatus.SC_LOCKED); return; String path = getRelativePath(req); StringBuilder methodsAllowed = determineMethodsAllowed(req); DocumentBuilder documentBuilder = getDocumentBuilder(); try {
log("Delete:" + path); if (isSpecialPath(path)) { errorList.put(path, Integer.valueOf(WebdavStatus.SC_FORBIDDEN)); return; childName += entry; if (isLocked(childName, ifHeader + lockTokenHeader)) { WebResource childResource = resources.getResource(childName); if (childResource.isDirectory()) { deleteCollection(req, childName, errorList);
lockTokenHeader = ""; if (isLocked(path, ifHeader + lockTokenHeader)) { resp.sendError(WebdavStatus.SC_LOCKED); return false; new Hashtable<String,Integer>(); deleteCollection(req, resources, path, errorList); try { resources.unbind(path); sendReport(req, resp, errorList); return false;
StringBuilder methodsAllowed = determineMethodsAllowed(resources, req); String path = getRelativePath(req); if (path.endsWith("/")) path = path.substring(0, path.length() - 1); DocumentBuilder documentBuilder = getDocumentBuilder(); generatedXML.writeElement (null, "multistatus" + generateNamespaceDeclarations(), XMLWriter.OPENING); parseLockNullProperties (req, generatedXML, lockNullPath, type, properties); + generateNamespaceDeclarations(), XMLWriter.OPENING); parseProperties(req, generatedXML, path, type, properties); } else { parseProperties(req, generatedXML, currentPath, type, properties); String lockNullPath = lockNullResourcesList.nextElement();
log("Delete:" + path); childName += ncPair.getName(); if (isLocked(childName, ifHeader + lockTokenHeader)) { Object object = resources.lookup(childName); if (object instanceof DirContext) { deleteCollection(req, resources, childName, errorList);
/** * COPY Method. */ protected void doCopy(HttpServletRequest req, HttpServletResponse resp) throws IOException { if (readOnly) { resp.sendError(WebdavStatus.SC_FORBIDDEN); return; } copyResource(req, resp); }
log("Copy: " + source + " To: " + dest); childSrc += "/"; childSrc += ncPair.getName(); copyResource(resources, errorList, childSrc, childDest);
/** * Handles the special WebDAV methods. */ protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String method = req.getMethod(); if (debug > 0) { String path = getRelativePath(req); log("[" + method + "] " + path); } if (method.equals(METHOD_PROPFIND)) { doPropfind(req, resp); } else if (method.equals(METHOD_PROPPATCH)) { doProppatch(req, resp); } else if (method.equals(METHOD_MKCOL)) { doMkcol(req, resp); } else if (method.equals(METHOD_COPY)) { doCopy(req, resp); } else if (method.equals(METHOD_MOVE)) { doMove(req, resp); } else if (method.equals(METHOD_LOCK)) { doLock(req, resp); } else if (method.equals(METHOD_UNLOCK)) { doUnlock(req, resp); } else { // DefaultServlet processing super.service(req, resp); } }
if (isLocked(req)) { resp.sendError(WebdavStatus.SC_LOCKED); return; String path = getRelativePath(req); StringBuilder methodsAllowed = determineMethodsAllowed(resources, req); DocumentBuilder documentBuilder = getDocumentBuilder(); try {
log("Delete:" + path); if (isSpecialPath(path)) { errorList.put(path, Integer.valueOf(WebdavStatus.SC_FORBIDDEN)); return; childName += entry; if (isLocked(childName, ifHeader + lockTokenHeader)) { WebResource childResource = resources.getResource(childName); if (childResource.isDirectory()) { deleteCollection(req, childName, errorList);
lockTokenHeader = ""; if (isLocked(path, ifHeader + lockTokenHeader)) { resp.sendError(WebdavStatus.SC_LOCKED); return false; new Hashtable<String,Integer>(); deleteCollection(req, resources, path, errorList); try { resources.unbind(path); sendReport(req, resp, errorList); return false;
StringBuilder methodsAllowed = determineMethodsAllowed(resources, req); String path = getRelativePath(req); if (path.endsWith("/")) path = path.substring(0, path.length() - 1); DocumentBuilder documentBuilder = getDocumentBuilder(); generatedXML.writeElement (null, "multistatus" + generateNamespaceDeclarations(), XMLWriter.OPENING); parseLockNullProperties (req, generatedXML, lockNullPath, type, properties); + generateNamespaceDeclarations(), XMLWriter.OPENING); parseProperties(req, generatedXML, path, type, properties); } else { parseProperties(req, generatedXML, currentPath, type, properties); String lockNullPath = lockNullResourcesList.nextElement();
/** * Delete a resource. * * @param req Servlet request * @param resp Servlet response * @return boolean true if the copy is successful */ private boolean deleteResource(HttpServletRequest req, HttpServletResponse resp) throws IOException { String path = getRelativePath(req); return deleteResource(path, req, resp, true); }
/** * DELETE Method. */ protected void doDelete(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { if (readOnly) { resp.sendError(WebdavStatus.SC_FORBIDDEN); return; } if (isLocked(req)) { resp.sendError(WebdavStatus.SC_LOCKED); return; } deleteResource(req, resp); }
log("Delete:" + path); childName += ncPair.getName(); if (isLocked(childName, ifHeader + lockTokenHeader)) { Object object = resources.lookup(childName); if (object instanceof DirContext) { deleteCollection(req, resources, childName, errorList);