use of org.apache.wicket.NonResettingRestartException in project webanno by webanno.
the class ExportDocumentDialogContent method export.
private FileResourceStream export() {
File downloadFile = null;
String username = state.getObject().getMode().equals(Mode.AUTOMATION) && preferences.getObject().documentType.equals(SELECTEXPORT.AUTOMATED.toString()) ? "CORRECTION_USER" : SecurityContextHolder.getContext().getAuthentication().getName();
try {
downloadFile = importExportService.exportAnnotationDocument(state.getObject().getDocument(), username, importExportService.getWritableFormats().get(importExportService.getWritableFormatId(preferences.getObject().format)), state.getObject().getDocument().getName(), state.getObject().getMode());
} catch (Exception e) {
LOG.error("Export failed", e);
error("Export failed:" + ExceptionUtils.getRootCauseMessage(e));
// RestartResponseException the feedback message only flashes.
throw new NonResettingRestartException(getPage().getPageClass());
}
return new FileResourceStream(downloadFile);
}
Aggregations