Package org.apache.sling.api.resource

Examples of org.apache.sling.api.resource.ResourceResolver.listChildren()


        do {
            selector = (selIdx < numRequestSelectors)
                    ? requestSelectors[selIdx]
                    : null;

            Iterator<Resource> children = resolver.listChildren(current);
            while (children.hasNext()) {
                Resource child = children.next();

                if (!this.isPathAllowed(child.getPath())) {
                    continue;
View Full Code Here


            name = this.scriptName;
        } else {
            current = getResource(resolver, location.getPath() + '/' + this.scriptName.substring(0, pos));
            name = this.scriptName.substring(pos + 1);
        }
        final Iterator<Resource> children = resolver.listChildren(current);
        while (children.hasNext()) {
            final Resource child = children.next();

            if ( !this.isPathAllowed(child.getPath()) ) {
                continue;
View Full Code Here

                final String cleanedPath = cleanPath(path, false);
                final boolean startsWithWebInfTags = cleanedPath.startsWith(WEB_INF_TAGS);

                Resource resource = resolver.getResource(startsWithWebInfTags ? cleanedPath.substring(WEB_INF_TAGS.length()) : cleanedPath);
                if (resource != null) {
                    Iterator<Resource> entries = resolver.listChildren(resource);
                    while (entries.hasNext()) {
                        final String entryPath = entries.next().getPath();
                        if (startsWithWebInfTags) {
                            paths.add(WEB_INF_TAGS + entryPath);
                        } else {
View Full Code Here

        Resource resource = resourceResolver.getResource("/single/test/withchildren");
        Assert.assertNotNull(resource);

        // test via the resource list children itself, this really just tests this test case.
        Iterator<Resource> resourceIterator = resourceResolver.listChildren(resource);
        Assert.assertNotNull(resourceResolver);
        int i = 0;
        while(resourceIterator.hasNext()) {
            Assert.assertEquals("m"+i, resourceIterator.next().getName());
            i++;
View Full Code Here

        // delegate resource listing to resource resolver
        if (currentResource instanceof SuperimposingResource) {
            final SuperimposingResource res = (SuperimposingResource) currentResource;
            final ResourceResolver resolver = res.getResource().getResourceResolver();
            final Iterator<Resource> children = resolver.listChildren(res.getResource());
            return new SuperimposingResourceIterator(this, children);
        }
        return null;
    }
View Full Code Here

            fail();
        } catch (final IllegalStateException ise) {
            // expected
        }
        try {
            rr.listChildren(null);
            fail();
        } catch (final IllegalStateException ise) {
            // expected
        }
        try {
View Full Code Here

        final Resource res1 = mock(Resource.class);
        final Resource res2 = mock(Resource.class);

        @SuppressWarnings("unchecked")
        final Iterator<Resource> itr = mock(Iterator.class);
        when(resourceResolver.listChildren(res)).thenReturn(itr);
        when(itr.hasNext()).thenReturn(true, true, false);
        when(itr.next()).thenReturn(res1, res2);
        when(res1.adaptTo(Node.class)).thenReturn(node1);
        when(res2.adaptTo(Node.class)).thenReturn(node1);
        when(node1.isNodeType("nt:hierarchyNode")).thenReturn(false);
View Full Code Here

        ResourceResolver resolver = requestResourceResolver.get();
        if (resolver != null) {
            try {
                Resource resource = resolver.getResource(cleanPath(path));
                if (resource != null) {
                    Iterator<Resource> entries = resolver.listChildren(resource);
                    while (entries.hasNext()) {
                        paths.add(entries.next().getPath());
                    }
                }
            } catch (SlingException se) {
View Full Code Here

        do {
            selector = (selIdx < numRequestSelectors)
                    ? requestSelectors[selIdx]
                    : null;

            Iterator<Resource> children = resolver.listChildren(current);
            while (children.hasNext()) {
                Resource child = children.next();

                String scriptName = ResourceUtil.getName(child);
                int lastDot = scriptName.lastIndexOf('.');
View Full Code Here

        ResourceResolver resolver = requestResourceResolver.get();
        if (resolver != null) {
            try {
                Resource resource = resolver.getResource(cleanPath(path));
                if (resource != null) {
                    Iterator<Resource> entries = resolver.listChildren(resource);
                    while (entries.hasNext()) {
                        paths.add(entries.next().getPath());
                    }
                }
            } catch (SlingException se) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.