public GridFsResource[] getResources(String locationPattern) { if (!StringUtils.hasText(locationPattern)) { return new GridFsResource[0]; } AntPath path = new AntPath(locationPattern); if (path.isPattern()) { GridFSFindIterable files = find(query(whereFilename().regex(path.toRegex()))); List<GridFsResource> resources = new ArrayList<>(); for (GridFSFile file : files) { resources.add(getResource(file)); } return resources.toArray(new GridFsResource[0]); } return new GridFsResource[] { getResource(locationPattern) }; }
@Override public Flux<ReactiveGridFsResource> getResources(String locationPattern) { if (!StringUtils.hasText(locationPattern)) { return Flux.empty(); } AntPath path = new AntPath(locationPattern); if (path.isPattern()) { Flux<GridFSFile> files = find(query(whereFilename().regex(path.toRegex()))); return files.flatMap(this::getResource); } return getResource(locationPattern).flux(); }
public GridFsResource[] getResources(String locationPattern) { if (!StringUtils.hasText(locationPattern)) { return new GridFsResource[0]; } AntPath path = new AntPath(locationPattern); if (path.isPattern()) { GridFSFindIterable files = find(query(whereFilename().regex(path.toRegex()))); List<GridFsResource> resources = new ArrayList<>(); for (GridFSFile file : files) { resources.add(getResource(file)); } return resources.toArray(new GridFsResource[0]); } return new GridFsResource[] { getResource(locationPattern) }; }