支持绝对路径的模糊匹配

This commit is contained in:
rain
2023-10-06 15:38:39 +08:00
parent 9fa94af5a8
commit 70954b4ae2
18 changed files with 175 additions and 58 deletions

View File

@@ -10,6 +10,7 @@ import cn.hutool.core.util.CharsetUtil;
import cn.hutool.core.util.StrUtil;
import com.yomahub.liteflow.exception.ConfigErrorException;
import com.yomahub.liteflow.spi.PathContentParser;
import com.yomahub.liteflow.util.PathMatchUtil;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.core.io.support.ResourcePatternResolver;
@@ -26,7 +27,8 @@ public class SpringPathContentParser implements PathContentParser {
@Override
public List<String> parseContent(List<String> pathList) throws Exception {
List<Resource> allResource = getResources(pathList);
List<String> absolutePathList = PathMatchUtil.searchAbsolutePath(pathList);
List<Resource> allResource = getResources(absolutePathList);
// 转换成内容List
List<String> contentList = new ArrayList<>();
@@ -42,7 +44,8 @@ public class SpringPathContentParser implements PathContentParser {
@Override
public List<String> getFileAbsolutePath(List<String> pathList) throws Exception {
List<Resource> allResource = getResources(pathList);
List<String> absolutePathList = PathMatchUtil.searchAbsolutePath(pathList);
List<Resource> allResource = getResources(absolutePathList);
return StreamUtil.of(allResource)
// 过滤非 file 类型 Resource