benstpierre
benstpierre

Reputation: 33591

GWT-Rpc how to return a file so that the browser pops up with a download dialog

Does anybody know if it is possible to have a GWT-rpc call cause a file download prompt to appear without having to do a second request to a separate servlet? I was thinking of having a method in the rpc servlet of return type void and then calling the response object directly to change the content type and cause the browser to open a download dialog.

Has anybody figured out a good way to achieve this without having a totally separate servlet?

Upvotes: 2

Views: 7079

Answers (2)

DonX
DonX

Reputation: 16379

I think you can try like this.On click of link you can do the following action.

Window.open("www.mydomain.com/downloadfile?fileId=something","_blank","");

Map the downloadfile url to some servlet and return the file.

But you cannot post data to server.You can add it in URL.In RPC call it is not possible send file.

Upvotes: 0

Maksim
Maksim

Reputation: 16941

It is not possible. HERE is the similar question I had while ago

Upvotes: 2

Related Questions