List of usage examples for com.vaadin.server FileResource setCacheTime
public void setCacheTime(long cacheTime)
From source file:nz.co.senanque.workflowui.AttachmentsPopup.java
License:Apache License
private void makeStream(final Attachment attachment) { final FileResource stream = new FileResource(new File("")) { private static final long serialVersionUID = 1L; @Override//from ww w .j a v a2s . c o m public DownloadStream getStream() { ByteArrayInputStream in = new ByteArrayInputStream(attachment.getBody()); DownloadStream ds = new DownloadStream(in, attachment.getMIMEType(), attachment.getFileName()); // Need a file download POPUP ds.setParameter("Content-Disposition", "attachment; filename=" + attachment.getFileName()); return ds; } }; stream.setCacheTime(0); Page.getCurrent().open(stream, "_blank", true); // panel.requestRepaint(); }