/** * The MOVE method * * @param request * @param response * @param resource * @throws IOException * @throws DavException */ protected void doMove(WebdavRequest request, WebdavResponse response, DavResource resource) throws IOException, DavException { DavResource destResource = getResourceFactory().createResource(request.getDestinationLocator(), request, response); int status = validateDestination(destResource, request, true); if (status > DavServletResponse.SC_NO_CONTENT) { response.sendError(status); return; } resource.move(destResource); response.setStatus(status); }
/** * The MOVE method * * @param request * @param response * @param resource * @throws IOException * @throws DavException */ protected void doMove(WebdavRequest request, WebdavResponse response, DavResource resource) throws IOException, DavException { DavResource destResource = getResourceFactory().createResource(request.getDestinationLocator(), request, response); int status = validateDestination(destResource, request, true); if (status > DavServletResponse.SC_NO_CONTENT) { response.sendError(status); return; } resource.move(destResource); response.setStatus(status); }
/** * The COPY method * * @param request * @param response * @param resource * @throws IOException * @throws DavException */ protected void doCopy(WebdavRequest request, WebdavResponse response, DavResource resource) throws IOException, DavException { // only depth 0 and infinity is allowed int depth = request.getDepth(DEPTH_INFINITY); if (!(depth == DEPTH_0 || depth == DEPTH_INFINITY)) { response.sendError(DavServletResponse.SC_BAD_REQUEST); return; } DavResource destResource = getResourceFactory().createResource(request.getDestinationLocator(), request, response); int status = validateDestination(destResource, request, true); if (status > DavServletResponse.SC_NO_CONTENT) { response.sendError(status); return; } resource.copy(destResource, depth == DEPTH_0); response.setStatus(status); }
/** * The COPY method * * @param request * @param response * @param resource * @throws IOException * @throws DavException */ protected void doCopy(WebdavRequest request, WebdavResponse response, DavResource resource) throws IOException, DavException { // only depth 0 and infinity is allowed int depth = request.getDepth(DEPTH_INFINITY); if (!(depth == DEPTH_0 || depth == DEPTH_INFINITY)) { response.sendError(DavServletResponse.SC_BAD_REQUEST); return; } DavResource destResource = getResourceFactory().createResource(request.getDestinationLocator(), request, response); int status = validateDestination(destResource, request, true); if (status > DavServletResponse.SC_NO_CONTENT) { response.sendError(status); return; } resource.copy(destResource, depth == DEPTH_0); response.setStatus(status); }
/** * The BIND method * * @param request * @param response * @param resource the collection resource to which a new member will be added * @throws IOException * @throws DavException */ protected void doBind(WebdavRequest request, WebdavResponse response, DavResource resource) throws IOException, DavException { if (!resource.exists()) { response.sendError(DavServletResponse.SC_NOT_FOUND); } BindInfo bindInfo = request.getBindInfo(); DavResource oldBinding = getResourceFactory().createResource(request.getHrefLocator(bindInfo.getHref()), request, response); if (!(oldBinding instanceof BindableResource)) { response.sendError(DavServletResponse.SC_METHOD_NOT_ALLOWED); return; } DavResource newBinding = getResourceFactory().createResource(request.getMemberLocator(bindInfo.getSegment()), request, response); int status = validateDestination(newBinding, request, false); if (status > DavServletResponse.SC_NO_CONTENT) { response.sendError(status); return; } ((BindableResource) oldBinding).bind(resource, newBinding); response.setStatus(status); }
/** * The REBIND method * * @param request * @param response * @param resource the collection resource to which a new member will be added * @throws IOException * @throws DavException */ protected void doRebind(WebdavRequest request, WebdavResponse response, DavResource resource) throws IOException, DavException { if (!resource.exists()) { response.sendError(DavServletResponse.SC_NOT_FOUND); } RebindInfo rebindInfo = request.getRebindInfo(); DavResource oldBinding = getResourceFactory().createResource(request.getHrefLocator(rebindInfo.getHref()), request, response); if (!(oldBinding instanceof BindableResource)) { response.sendError(DavServletResponse.SC_METHOD_NOT_ALLOWED); return; } DavResource newBinding = getResourceFactory().createResource(request.getMemberLocator(rebindInfo.getSegment()), request, response); int status = validateDestination(newBinding, request, false); if (status > DavServletResponse.SC_NO_CONTENT) { response.sendError(status); return; } ((BindableResource) oldBinding).rebind(resource, newBinding); response.setStatus(status); }
/** * The BIND method * * @param request * @param response * @param resource the collection resource to which a new member will be added * @throws IOException * @throws DavException */ protected void doBind(WebdavRequest request, WebdavResponse response, DavResource resource) throws IOException, DavException { if (!resource.exists()) { response.sendError(DavServletResponse.SC_NOT_FOUND); } BindInfo bindInfo = request.getBindInfo(); DavResource oldBinding = getResourceFactory().createResource(request.getHrefLocator(bindInfo.getHref()), request, response); if (!(oldBinding instanceof BindableResource)) { response.sendError(DavServletResponse.SC_METHOD_NOT_ALLOWED); return; } DavResource newBinding = getResourceFactory().createResource(request.getMemberLocator(bindInfo.getSegment()), request, response); int status = validateDestination(newBinding, request, false); if (status > DavServletResponse.SC_NO_CONTENT) { response.sendError(status); return; } ((BindableResource) oldBinding).bind(resource, newBinding); response.setStatus(status); }
/** * The REBIND method * * @param request * @param response * @param resource the collection resource to which a new member will be added * @throws IOException * @throws DavException */ protected void doRebind(WebdavRequest request, WebdavResponse response, DavResource resource) throws IOException, DavException { if (!resource.exists()) { response.sendError(DavServletResponse.SC_NOT_FOUND); } RebindInfo rebindInfo = request.getRebindInfo(); DavResource oldBinding = getResourceFactory().createResource(request.getHrefLocator(rebindInfo.getHref()), request, response); if (!(oldBinding instanceof BindableResource)) { response.sendError(DavServletResponse.SC_METHOD_NOT_ALLOWED); return; } DavResource newBinding = getResourceFactory().createResource(request.getMemberLocator(rebindInfo.getSegment()), request, response); int status = validateDestination(newBinding, request, false); if (status > DavServletResponse.SC_NO_CONTENT) { response.sendError(status); return; } ((BindableResource) oldBinding).rebind(resource, newBinding); response.setStatus(status); }