|
|
|
|
Re: how to locate a url and download a file without generating html in html and clicking it? [message #752865 is a reply to message #752510] |
Wed, 26 October 2011 10:49  |
Eclipse User |
|
|
|
my way is as below,
create an IServiceHandler implemented class,
response.setContentType( "application/ms-excel" );
String contentDisposition = "attachment; filename=" + fileName;
response.setContentType("application/force-download");
response.setHeader("Content-Disposition", contentDisposition);
response.setHeader("Content-Transfer-Encoding", "binary");
response.setHeader("Pragma", "no-cache");
response.setHeader("Cache-Control", "no-cache, must-revalidate");
and invoke like this,
RWT.getServiceManager().registerServiceHandler( SERVICE_HANDLER, new ExcelServiceHandler(fileName );
no so good is a new browser window opened every time to download the file, and opening new window is limited by many browsers and other tools!
Anybody has better ways?
David
|
|
|
Powered by
FUDForum. Page generated in 0.04413 seconds