if (!filePath.equals("")) {
PathFilter pathFilter = PathFilter.create(filePath);
treeWalk.setFilter(pathFilter);
}
if (!treeWalk.next()) {
CanonicalTreeParser canonicalTreeParser = treeWalk
.getTree(0, CanonicalTreeParser.class);
ArrayList<HashMap<String, Object>> contents = new ArrayList<HashMap<String, Object>>();
if (canonicalTreeParser != null) {
while (!canonicalTreeParser.eof()) {
String path = canonicalTreeParser
.getEntryPathString();
FileMode mode = canonicalTreeParser
.getEntryFileMode();
listEntry(path, mode.equals(FileMode.TREE) ? "dir"
: "file", "0", path, projectName, head.getName(), git, contents);
canonicalTreeParser.next();
}
}
String response = JSONUtil.write(contents);
resp.setContentType("application/json");
resp.setHeader("Cache-Control", "no-cache");