Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filedownload.save does not work with piped streams #2732

Open
siepkes opened this issue Jan 24, 2022 · 0 comments
Open

Filedownload.save does not work with piped streams #2732

siepkes opened this issue Jan 24, 2022 · 0 comments

Comments

@siepkes
Copy link

siepkes commented Jan 24, 2022

The Filedownload.save method does not work when supplying it with a PipedInputStream.

The following example (see also zkfidle) does not work. The download dialog will simply never appear. There is no error logged whatsoever:

<zk>
	<zscript><![CDATA[
	import org.zkoss.zul.Filedownload;
	import java.io.InputStream;
	import org.zkoss.lang.Strings;
	import java.io.PipedInputStream;
	import java.io.PipedOutputStream;	

	void download() throws Exception {

		final PipedOutputStream pipedOutputStream = new PipedOutputStream();
		final PipedInputStream pipedInputStream = new PipedInputStream(pipedOutputStream);
			
		Thread outputThread = new Thread(new Runnable() {
			public void run() {
				pipedOutputStream.write(new byte[] { 0x1, 0x2, 0x3, 0xf } );
   			}
				
		});
		outputThread.start();		
						
		Filedownload.save(pipedInputStream, "application/xml", "test.xml");
		
		outputThread.join();
	}
	]]></zscript>
	<button label="download" onClick="download()">
	</button>
</zk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant