|
Hi, I'm using Wicket 6.7.0 with an embedded Jetty and implemented a file download mechanism as suggested here: https://cwiki.apache.org/confluence/display/WICKET/AJAX+update+and+file+download+in+one+blow My implementation is slighlty different from the suggested one, but still I think it is pretty much the same: private void writeDownload(final List<TransferModel> transfers) { String fileName = UrlEncoder.QUERY_INSTANCE.encode("logExport-" + CalendarTool.format(beginDate) + "-" + CalendarTool.format(endDate) + ".csv", getRequest().getCharset()); IResourceStream resourceStream = new AbstractResourceStreamWriter() { @Override public void write(OutputStream output) throws IOException { BHLogExport.writeCSVLog(transfers, output, getLocalizer(), Session.get().getLocale(), LogExportPanel.this); } @Override public String getContentType() { return "text/csv"; } }; ResourceStreamRequestHandler resource = new ResourceStreamRequestHandler(resourceStream, fileName); resource.setContentDisposition(ContentDisposition.ATTACHMENT); resource.setCacheDuration(Duration.NONE); // resource.setFileName(fileName); getRequestCycle().scheduleRequestHandlerAfterCurrent(resource); try { resourceStream.close(); } catch (IOException e) { throw new CryptshareRuntimeException("An error occured while trying to write the csv file to the output stream.", e); } } I am using a custom Button wrapping an AjaxButton. Except from that, there is no difference, but I still keep getting an error message instead of the file download dialog. Do you have any suggestions what I might be doing wrong? Thanks and best regards, René Hartwig --
René
Hartwig Befine
Solutions AG - The Cryptshare Company Tel: +49 (0) 761 38913
0 ========================================================================= Your attachments are
too large or too confidential for e-mail? ========================================================================= |
- Ajax file download - Invalid XML René Hartwig
- Re: Ajax file download - Invalid XML Ernesto Reinaldo Barreiro
- Re: Ajax file download - Invalid XML Martin Grigorov
- Re: Ajax file download - Invalid XML Ernesto Reinaldo Barreiro
- Re: Ajax file download - Invalid XM... René Hartwig


