Search in sources :

Example 1 with NonResettingRestartException

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);
}
Also used : NonResettingRestartException(org.apache.wicket.NonResettingRestartException) FileResourceStream(org.apache.wicket.util.resource.FileResourceStream) File(java.io.File) NonResettingRestartException(org.apache.wicket.NonResettingRestartException)

Aggregations

File (java.io.File)1 NonResettingRestartException (org.apache.wicket.NonResettingRestartException)1 FileResourceStream (org.apache.wicket.util.resource.FileResourceStream)1