@Test public void listChildren() { Resource resource = context.resourceResolver().getResource("/md-test/child-listing"); List<Resource> children = new ArrayList<>(); resource.getChildren().forEach( children::add ); assertThat("children", children, hasSize(3)); assertThat("children.paths", children.stream().map( r -> r.getPath()).collect(Collectors.toList()), hasItems("/md-test/child-listing/news", "/md-test/child-listing/spam", "/md-test/child-listing/comments")); Resource newsResource = children.stream() .filter( r -> r.getPath().equals("/md-test/child-listing/spam") ) .findFirst() .get(); assertThat("newsResource.valueMap[jcr:title]", newsResource.getValueMap().get("jcr:title", String.class), equalTo("Spam (correct)")); }
@Override public Iterator<Resource> listChildren(ResolveContext<Object> ctx, Resource parent) { Path root = Paths.get(fsPath, parent.getPath()); try { return Files.list(root) .map( p -> asResource(p, Paths.get(parent.getPath()), ctx)) .filter( r -> r != null ) .collect(Collectors.toList()) .iterator(); } catch (IOException e) { throw new RuntimeException(e); } }
MarkdownResourceProvider extends ResourceProvider<Object> { @Override public Iterator<Resource> listChildren(ResolveContext<Object> ctx, Resource parent) { Path root = Paths.get(fsPath, parent.getPath()); try { return Files.list(root) .map( p -> asResource(p, Paths.get(parent.getPath()), ctx)) .filter( r -> r != null ) .collect(Collectors.toList()) .iterator(); } catch (IOException e) { throw new RuntimeException(e); } } }
MarkdownResourceProvider extends ResourceProvider<Object> { @Override public Iterator<Resource> listChildren(ResolveContext<Object> ctx, Resource parent) { Path root = Paths.get(fsPath, parent.getPath()); try { return Files.list(root) .map( p -> asResource(p, Paths.get(parent.getPath()), ctx)) .filter( r -> r != null ) .collect(Collectors.toList()) .iterator(); } catch (IOException e) { throw new RuntimeException(e); } }  }
MarkdownResourceProvider extends ResourceProvider<Object> { @Override public Iterator<Resource> listChildren(ResolveContext<Object> ctx, Resource parent) { Path root = Paths.get(fsPath, parent.getPath()); try { return Files.list(root) .map( p -> asResource(p, Paths.get(parent.getPath()), ctx)) .filter( r -> r != null ) .collect(Collectors.toList()) .iterator(); } catch (IOException e) { throw new RuntimeException(e); } }  @Override Resource getResource(ResolveContext<Object> ctx, String path, ResourceContext resourceContext,
            Resource parent); @Override Iterator<Resource> listChildren(ResolveContext<Object> ctx, Resource parent); }
MarkdownResourceProvider extends ResourceProvider<Object> { @Override public Iterator<Resource> listChildren(ResolveContext<Object> ctx, Resource parent) { Path root = Paths.get(fsPath, parent.getPath()); try { return Files.list(root) .map( p -> asResource(p, Paths.get(parent.getPath()), ctx)) .filter( r -> r != null ) .collect(Collectors.toList()) .iterator(); } catch (IOException e) { throw new RuntimeException(e); } }  @Override Resource getResource(ResolveContext<Object> ctx, String path, ResourceContext resourceContext,
            Resource parent); @Override Iterator<Resource> listChildren(ResolveContext<Object> ctx, Resource parent);  }