Monday, March 21, 2016

Re: downloading file from servlet

Thanks for this discussion, I'm able to resolve one of the issues I was running in to.  Now I have 'A' solution if not the most perfect one. 

The use I have is - 
  1. User creates a drawing on HTML5 canvas.
  2. Drawing is converted to SVG on the browser.
  3. User wants to save the drawing as SVG file.
  4. However, I'm not sure a way exists the to save the SVG directly from the browser.
  5. So the string representing SVG is sent to the server.
  6. Server creates a name for the SVG.
  7. And sends the SVG back to the browser.
  8. The browser instantly saves the file with the name assigned by the browser.
That's really good, but I'm sure there has to be a way to save the SVG created by the JS code without making a round trip to server.  Has any one have the know how?

Thanks
Velu

On Tuesday, October 19, 2010 at 11:49:12 PM UTC-4, mike b wrote:
I have read all the other posts about downloading Excel files and how
to do it w/ an IFRAME, with RequestBuilder, and Window.open().
However, none of them actually work.  Luckily, I have a working
servlet which executes and returns successfully with javascript.
However, we'd like to do it all in GWT.  The error message from IE is
below.  The Window.open() DOES work with FF, but not with IE.
Unfortunately, we must deploy to IE, no options there.

Situation:
GWT 2.0.4  mvp4g 1.2.0
Need to download a file to open in Excel.  At this point, its actually
a text file, but the MIME type is setup for Excel.

The servlet has been tested w/ straight java script using
"document.body.appendChild(iframe);".  This works like a champ in IE
and FF.

However, when I do "Window.open(url, "_self",null);" in GWT, IE can't
download the file.  It throws an error saying...

"
Internet Exploroer cannot download MyFile from localhost

IE was not able to open this Internet site.  The requests site is
either unavailable or cannot be found.  Please try again later.
"

In GWT, I have also tried just using a Frame, adding it to a Panel,
and then calling myFrame.setUrl("myUrl");

This also successfully gets to the servlet, but fails w/ the above
error message while trying to "open" the file.

It seems as if GWT is telling the browser to cancel the download when
it pops up.

Any suggestions?  Any guesses?

Thanks,
mikeb

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment