Vaadin 6.5.5 and downloading with FileResource

Hi all,
maybe it’s me that is doing something wrong, but I’ve noticed that with the latest Vaadin 6.5.5 my downloading PDF functionality is no more working, while it is with 6.5.4.

this is how I’m doing it, based on the code found in this forum:


downloadPDFButton = new Button(Lang.getMessage("downloadPDF"), mainForm, "commit");
			downloadPDFButton.addListener(new ClickListener() {

				@Override
				public void buttonClick(ClickEvent event) {
					try {
						log.info("Clicked commit: " + event);
	
						String path = getApplication().getContext().getBaseDirectory().getAbsolutePath();
						log.info("Computed path: " + path);
	
						FileDownloadResource fdr = new FileDownloadResource(generateFileFromForm(), getApplication());
						fdr.setCacheTime(0);
						log.info("fdr file name: " + fdr.getFilename() + ", ct: " + fdr.getStream().getContentType());
						
						open(fdr, "_blank");
					} catch(Throwable t) {
						showNotification(Lang.getMessage("errorGeneratingDocumentPleaseRetry"), Notification.TYPE_ERROR_MESSAGE);
					}
				}
			});

and FileDownloadResource has method:


public DownloadStream getStream() {
		try {
			final DownloadStream ds = super.getStream();
			log.info("Setting parameter Content-Disposition to: " + getFilename());
			ds.setParameter("Content-Disposition", "attachment; filename=\"" +getFilename() + "\"");
			ds.setCacheTime(getCacheTime());
			return ds;
		} catch (final Exception e) {
			log.error("File not found when downloading: " + e.getLocalizedMessage());
			log.error("File name: " + getFilename());
			e.printStackTrace();
			return null;
		}
	}

Instead of starting the download, I get something like url: app://APP/1/…/filename.pdf, which is “unhandled” by the browsers.
Is this a bug?

Regards,
Davide

Hi,

Its this issue: http://dev.vaadin.com/ticket/6849

A 6.5.6 should be out today or you could go straight to 6.5.x nightly builds.

cheers,
matti