After returning a org.directwebremoting.io.FileTransfer object from a java method, the name parameter in the constructor seems to be ignored. Instead a random hex value is returned on the javascript side.
java:
return new FileTransfer("filename.txt", "text/comma-separated-values", buffer.toByteArray());
js:
DownloadService.getFile( {
callback: function(data) { window.open(data); } // data is a string pointing to /<context>/dwr/download/<random-hex-value>
});
After returning a org.directwebremoting.io.FileTransfer object from a java method, the name parameter in the constructor seems to be ignored. Instead a random hex value is returned on the javascript side.
This issue was already discussed here: http://www.nabble.com/Re%3A-What-is-the-proper-way-to-open-the-file-returned-by-FileTransfer--p15510849.html
java:
return new FileTransfer("filename.txt", "text/comma-separated-values", buffer.toByteArray());
js:
DownloadService.getFile( {
callback: function(data) { window.open(data); } // data is a string pointing to /<context>/dwr/download/<random-hex-value>
});
Issue Links
Duplicate
This issue duplicates:
DWR-202
FileTransfer does not return the correct file name
Michael Benz added a comment - 18/Apr/08 1:36 PM I must have missed ticket 202 which describes the same issue: http://getahead.org/bugs/browse/DWR-202
It is tagged as resolved in 3.0.M1, but i believe it still exists in 3.0.M2 and the current HEAD from the svn
I have done some testing on this, and it currently appears that if you are using data: URLs then there is no way for DWR to pass a filename. The default is to use out-of-band download for all browsers now so this ought to crop up less often.
Joe Walker added a comment - 30/Oct/08 1:49 PM I have done some testing on this, and it currently appears that if you are using data: URLs then there is no way for DWR to pass a filename. The default is to use out-of-band download for all browsers now so this ought to crop up less often.
I must have missed ticket 202 which describes the same issue: http://getahead.org/bugs/browse/DWR-202
It is tagged as resolved in 3.0.M1, but i believe it still exists in 3.0.M2 and the current HEAD from the svn