The download is done with a servlet which I direct to a hidden frame.
In my project's HTML I put
<iframe src="javascript:''" id="__gwt_downloadFrame" style="width:
0;height:0;border:0"></iframe>
just below my history frame. In loading my module class is
private static final String DOWNLOAD_IFRAME = "__gwt_downloadFrame";
private static Frame downloadFrame;
which I wrap in onModule load with
// Get the hidden frame that's our download target.
downloadFrame =
Frame.wrap(Document.get().getElementById(DOWNLOAD_IFRAME));
and make available with a static method:
public static void downloadURL(String url) {
downloadFrame.setUrl(url);
}
If the RPC completes properly, I call the download servlet:
String saveURL = GWT.getModuleBaseURL() +
"downloadServlet?..." [params]
MyProject.downloadURL(saveURL);
You may have to do some other hand waving in the servlet to set the
proper headers, esp.with SSL (http://www.jspwiki.org/wiki/
BugSSLAndIENoCacheBug).
On Jul 27, 8:07 am, Sean <slough...@gmail.com> wrote:
> Hi,
>
> I've followed a bunch of tutorials and I'm able to click a button, send
> parameters via a Window.open() call to an HttpServlet and it will construct
> a bunch of files, zip them up and send them back. The problem is sometimes
> creating these files can take some time, and a blank window just stares at
> me while it's doing so. I was wondering if there's a nicer way, like an RPC
> so I can tell when it's returned or an error has occurred but still have a
> File Dialog pop up for the user to save the .zip as normal?
>
> Thank you.
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
No comments:
Post a Comment