ajax request.
One way to invoke browser download dialog is setting URL of an iframe.
You can do following to implement file download with GWT.
1) Write a download servlet which writes byte[] to servlet output
stream. And map it to say /download.do
2) Create an hidden IFrame
2) Construct URL on GWT Client side which points to /download.do with
required parameters.
3) On click of GWT Button, set URL of the hidden IFrame with
constructed URL.
This should invoke download dialog of browser.
Regards
On Sep 21, 1:52 pm, meetmrdeepak <meetmrdee...@gmail.com> wrote:
> Hi,
>
> I have to integrate file download into my GWT application.
>
> UseCase - User clicks on Export Button (gwt button), call will go to
> RPC servlet, RPC servlet will fetch data from database and convert the
> records in List<DTO> and this List will be passed to export Service to
> get Byte[].
>
> NOTE: I have a EXPORT service (spring service as separate-module/
> separate-jar), which accepts List<String> as column headers, and
> List<DTO> as records. This service generates excel, pdf, csv based on
> some parameter and rerturns byte[] along with other file information
> (file type, size etc).
>
> Problem 1: Even if i have byte[] in my RPC servlet, how can i trigger
> download file dialogue on client browser. since RPC servlet cannot
> write outputstream as normal servlet does.
> Problem 2: I cannot use RequestBuilder as it doesnt allows me to pass
> Object to another servlet. it can only pass string in form of GET
> request.
> Problem 3: I dont want to write servlets for each file download.
> Rather I would prefer to write single servlet, which will fetch byte[]
> from request attribute, and will write that byte[] to output stream.
>
> Please guide me in this direction.
--
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