Hi Andreas:
It's quite possible to "... trigger a download via GWT..." You don't say
what MIME type you're wanting. For example, I trigger a download of PDF
document. GWT code cannot handle that, so the trigger is a GWT write to an
IFrame URL. The browser then renders the PDF in that frame.
Perhaps you want to download HTML? If so, you have to stuff those results
into some GWT widget. I usually do something like a MIME type of text/json,
which can be handled using a Javascript overlay type.
{ "status":"%S-Success", "cargo":"<div>stuff</div>"}
which can handle situations like
{"status":"%F-Fail","cargo":"<div>requested data not found</div>"}
On Thu, May 27, 2010 at 7:17 AM, andreas <[email protected]>wrote:
> Hi,
>
> I'm trying to trigger a download via GWT rpc and/or GWT
> RequestBuilder. The motivation of using rpc and/or RequestBuilder is
> the ability to send data required for the on-the-fly generated
> download files that way.
>
> I already managed to modify the underlying request by using
> RequestBuilder as return value of the rpc service method. The request
> is routed to a HttpServlet implementing the doPost method. GWT utility
> classes are used to obtain the RPCRequest instance and the given
> parameters of the rpc service call successfully out of the
> HttpRequest. After using the parameters and assembling the file on the
> servlet in the doPost method the HttpResponse instance is used to
> write that file. Headers 'content-disposition' and 'content-type' are
> set accordingly to trigger a download in the browser.
>
> However a download does not start. The response is accessible in the
> RequestCallback instance assigned to the request. The point I do not
> get about this is why the browser does not react to the content
> disposition by downloading the file and instead passing the response
> back to the ajax-world. I know that the rpc or request would fail
> otherwise but that would be perfectly fine, since no response is
> desired but a download.
>
> Related posts:
>
> http://groups.google.com/group/google-web-toolkit/browse_thread/thread/be6f95db3a4313c2/8f10a1c1e6500ccf?lnk=gst&q=download#8f10a1c1e6500ccf
>
>
> http://groups.google.com/group/google-web-toolkit/browse_thread/thread/388e72fb8e652122/dea4693ce6642f2c?lnk=gst&q=download#dea4693ce6642f2c
>
> I know that there are solutions with backposts and passing data via
> parameters in the request url, but i would love to just stick to one
> mechanism which is GWT rpc. I read a lot about that doing what i would
> like to do is not possible but no one really said why. I especially
> wonder why the browser does not do its thing since it is surely the
> one that gets the response before the ajax code doesn't he?
>
> I would like to hear about other solutions and if possible about why
> exactly it is not possible to trigger download via GWT rpc. After all
> escaping the GWT rpc mechanism on the server side works fine but on
> the browser side not. Any ideas?
>
> Greetings,
> Andreas
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-web-toolkit%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.