%@ page contentType="text/html; charset=UTF-8" %>
<%@ page import="java.io.*,java.util.*,org.json.*" %>
<%!
ArrayList listDirsForFolder(final File folder) {
ArrayList fileList = new ArrayList();
for (final File fileEntry : folder.listFiles()) {
if (fileEntry.isDirectory()) {
if (!fileEntry.getName().startsWith(".")) {
fileList.add(fileEntry);
}
}
}
return fileList;
}
%>
<%
String doc_base = getServletContext().getRealPath("/");
File pub_dir = new File(doc_base,"published");
ArrayList my_pub_dirs = listDirsForFolder(pub_dir);
JSONArray json = new JSONArray();
for (final File fileEntry : my_pub_dirs) {
json.put(fileEntry.getName());
}
out.println(json.toString());
out.flush();
%>