URL url =
new URL(
frontUrl+"/section/"
+ section.getId()
+ ".html?static=true&nocache=true");
BufferedReader reader =
new BufferedReader(
new InputStreamReader(url.openStream()));
String content = "<!-- �ON static export -->";
String line = "";
while (line != null) {
line = reader.readLine();
if (line != null) {
content += line;
}
}
ZipEntry ze =
new ZipEntry("section/" + section.getId() + ".html");
zip.putNextEntry(ze);
zip.write(content.getBytes());
zip.closeEntry();
} catch (Exception e) {
System.out.println(
"Static export error, section " + section.getId());
}
}
// add publications
Mapping.begin();
Vector publications = Publication.listAll();
Mapping.rollback();
for (int i = 0; i < publications.size(); i++) {
Publication publication = (Publication) publications.get(i);
try {
URL url =
new URL(
frontUrl+"/publication/"
+ publication.getId()
+ ".html?static=true&nocache=true");
BufferedReader reader =
new BufferedReader(
new InputStreamReader(url.openStream()));
String content = "<!-- �ON static export -->";
String line = "";
while (line != null) {
line = reader.readLine();
if (line != null) {
content += line;
}
}
ZipEntry ze =
new ZipEntry(
"publication/" + publication.getId() + ".html");
zip.putNextEntry(ze);
zip.write(content.getBytes());
zip.closeEntry();
} catch (Exception e) {
System.out.println(
"Static export error, publication "
+ publication.getId());
}
}
// add index
URL url =
new URL(
frontUrl+"?static=true&nocache=true");
BufferedReader reader =
new BufferedReader(new InputStreamReader(url.openStream()));
String content = "<!-- �ON static export -->";
String line = "";
while (line != null) {
line = reader.readLine();
if (line != null) {
content += line;
}
}
ZipEntry ze = new ZipEntry("section/index.html");