resp.setStatus(HttpServletResponse.SC_OK);
resp.setContentType("application/zip");
OutputStream os = resp.getOutputStream();
try {
ExportTarget tgt = new JsonExport.ZipExportTarget(os,false,true);
JsonExport exp = new JsonExport(tgt);
exp.setItemFilter(new JsonImportExport.ItemFilter() {
@Override
public boolean accept(Item item) throws NotesException {
String name = item.getName();
// We need this field to keep the history!
//if(name.equalsIgnoreCase("$UpdatedBy")) {
// return false;
//}
return true;
}
});
String viewName = "AllSnippetsById";
if(StringUtil.equals(key,"alldocs")) {
viewName = "AllDocs";
key = null;
}
View view = DominoUtils.getCurrentDatabase().getView(viewName);
try {
exp.exportDocuments(view,key);
} finally {
view.recycle();
}
} finally {
os.flush();