backup.toDirectory(dir);
zipDir(dir,zipFile);
deleteDir(dir);
*/
getResponse().setStatus(Status.SUCCESS_OK);
Representation rep = new FileRepresentation(zipFile,MediaType.APPLICATION_ZIP) {
public void release() {
zipFile.delete();
}
};
Disposition disposition = new Disposition();
disposition.setFilename("backup.zip");
rep.setDisposition(disposition);
return rep;
} catch (Exception ex) {
getContext().getLogger().log(Level.SEVERE,"Cannot perform backup to due to exception: "+ex.getMessage(),ex);
getResponse().setStatus(Status.SERVER_ERROR_INTERNAL);
return new StringRepresentation("Cannot perform backup to due to exception.");