protected void doRun()

in src/main/java/org/apache/sling/servlets/post/impl/operations/DeleteOperation.java [51:82]


    protected void doRun(final SlingHttpServletRequest request,
            final PostResponse response, final List<Modification> changes)
    throws PersistenceException {

        // SLING-3203: selectors, extension and suffix make no sense here and
        // might lead to deleting other resources than the one the user means.
        final RequestPathInfo rpi = request.getRequestPathInfo();
        if( (rpi.getSelectors() != null && rpi.getSelectors().length > 0)
                || (rpi.getExtension() != null && rpi.getExtension().length() > 0)
                || (rpi.getSuffix() != null && rpi.getSuffix().length() > 0)) {
            response.setStatus(
                    HttpServletResponse.SC_FORBIDDEN,
                    "DeleteOperation request cannot include any selectors, extension or suffix");
            return;
        }

        final VersioningConfiguration versioningConfiguration = getVersioningConfiguration(request);
        final boolean deleteChunks = isDeleteChunkRequest(request);
        final Iterator<Resource> res = getApplyToResources(request);
        if (res == null) {
            final Resource resource = request.getResource();
            deleteResource(resource, changes, versioningConfiguration,
                deleteChunks);
        } else {
            while (res.hasNext()) {
                final Resource resource = res.next();
                deleteResource(resource, changes, versioningConfiguration,
                    deleteChunks);
            }

        }
    }