Tuesday, September 21, 2010

GWT File Download

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