0

I am sending request on server, and server returns StreamingOutput (wriring bytes of pdf file) In onResponseRecieved i need to handle this file and start download. How to start to download this file?

Liza Tjaica
  • 593
  • 1
  • 7
  • 16

1 Answers1

0

I supose you dont need to process that data in javascript, do you?

If you just want to download the file or display it in the browser, create a button in your page so as when the user clicks it will show in a new window or the user will asked to save the file:

final String url = "http://gwtquery.googlecode.com/git/README.txt";
String name = "README.txt";

Anchor link1 = new Anchor(name);
RootPanel.get().add(link1);
link1.addClickHandler(new ClickHandler() {
  public void onClick(ClickEvent event) {
    Window.open(url, "_blank", "");
  }
});
Manolo Carrasco Moñino
  • 9,723
  • 1
  • 22
  • 27