Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-1991

AMedia FileDownload support ignore add Content-Disposition to header

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Normal
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 7.0.0
    • Component/s: ZK Update Engine
    • Security Level: Jimmy
    • Labels:
      None

      Description

      With Content-Disposition header, IE 10 will show up confirm dialog
      http://screencast.com/t/Rd3Ki3XoVm

      <zk>
      	<window apply="org.zkoss.bind.BindComposer"
      		viewModel="@id('vm') @init('foo.FiledownloadVM')">
      		<textbox value="@bind(vm.dynamicContent)"/>
      		
      		<button  label="download" onClick="@command('download')" />
      	</window>
      </zk>
      
      import org.zkoss.bind.annotation.Command;
      import org.zkoss.cht.system.DownloadFilter;
      import org.zkoss.util.media.AMedia;
      import org.zkoss.zk.ui.Executions;
      import org.zkoss.zk.ui.util.Clients;
      
      public class FiledownloadVM {
      
      	private String dynamicContent = "downloadContent";
      	
      	
      	@Command
      	public void download() {
      		InputStream is = new ByteArrayInputStream(dynamicContent.getBytes(Charset.forName("utf-8")));
      		
      		AMedia media = new AMedia("file", "txt", "text/plain", is);
      		
      		String url = Executions.getCurrent().getDesktop().getDownloadMediaURI(media, "report");
      		Clients.evalJavaScript("window.open('"+url+"')");
      	}
      
      
      	public String getDynamicContent() {
      		return dynamicContent;
      	}
      	
      	public void setDynamicContent(String dynamicContent) {
      		this.dynamicContent = dynamicContent;
      	}
      
      }
      

        Attachments

          Activity

            People

            Assignee:
            vincentjian vincentjian
            Reporter:
            jimmyshiau jimmyshiau
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: