// add resources
Vector beans = Resources.getResourceXmlBeans(this);
for (int i = 0; i < beans.size(); i++) {
ResourceXmlBean bean = (ResourceXmlBean) beans.get(i);
File root =
new File(
getServletContext().getRealPath("/"),
resourcesPath);
File dir = new File(root, bean.getDirectory());
File[] files = dir.listFiles();
for (int k = 0; k < files.length; k++) {
File file = files[k];
if (file.isFile()) {
InputStream in = new FileInputStream(file);
ZipEntry ze =
new ZipEntry(
"resources/"
+ bean.getId()
+ "/"
+ file.getName());
zip.putNextEntry(ze);
// Transfer bytes from the file to the ZIP file
int len;
while ((len = in.read(buf)) > 0) {
zip.write(buf, 0, len);
}
zip.closeEntry();
in.close();
}
}
}
// add images
File root =
new File(getServletContext().getRealPath("/"), imagesPath);
File[] files = root.listFiles();
for (int k = 0; k < files.length; k++) {
File file = files[k];
if (file.isFile()) {
InputStream in = new FileInputStream(file);
ZipEntry ze = new ZipEntry("images/" + file.getName());
zip.putNextEntry(ze);
// Transfer bytes from the file to the ZIP file
int len;
while ((len = in.read(buf)) > 0) {