final Map<String, String> root = buildRoot(request, doc);
final String path = root.get("path");
final boolean recur = "yes".equals(root.get("recursive"));
final Pattern filter = Pattern.compile(root.get("filter"));
final Pattern exclude = Pattern.compile(root.get("exclude"));
ClientProtocol nnproxy = createNameNodeProxy(ugi);
doc.declaration();
doc.startTag("listing");
for (Map.Entry<String,String> m : root.entrySet()) {
doc.attribute(m.getKey(), m.getValue());
}
FileStatus base = nnproxy.getFileInfo(path);
if ((base != null) && base.isDir()) {
writeInfo(base, doc);
}
Stack<String> pathstack = new Stack<String>();
pathstack.push(path);
while (!pathstack.empty()) {
String p = pathstack.pop();
try {
for (FileStatus i : nnproxy.getListing(p)) {
if (exclude.matcher(i.getPath().getName()).matches()
|| !filter.matcher(i.getPath().getName()).matches()) {
continue;
}
if (recur && i.isDir()) {