I do not underatand how to implement step 2 and 3, so I try to use GWT-RPC
to call servlet to export the data, to simplify the case, I just try to
hardcode the output text first, with the following code in the
RemoteServiceServlet
public void exportHistory(ArrayList<String> sqlHistory){
> this.sqlHistory = sqlHistory;
> try {
> HttpServletResponse res = this.getThreadLocalResponse();
> res.setContentType("text/plain");
> res.setHeader("Content-disposition", "attachment;
> filename=history.txt");
> ServletOutputStream out = res.getOutputStream();
> out.println("test1");
> out.println("test2");
> out.flush();
> } catch (IOException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
> }
>
there is no exception in this segment, but it return onFailure(Throwable
caught) in the asyncCallback<Void>, the caught is InvocationException.
What is the problem?
On Thu, Jun 14, 2012 at 10:37 PM, Joseph Lust <[email protected]> wrote:
>
> tong,
>
> I have not tested this, but the following should do the trick for you.
>
>
> 1) Write a method to convert your sqlHistory to a string with the desired
line returns (if you want each list entry on a separate row).
>
> 2) Convert it to a DataUrl for a text file with MIME "text/plain"
>
> 3) Open a new window with the URL from (2) to trigger a file download.
>
>
> Sincerely,
> Joseph
>
> --
> You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
> To view this discussion on the web visit
https://groups.google.com/d/msg/google-web-toolkit/-/JLZmg_Mnxg0J.
>
> 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.
--
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.