tags:

views:

44

answers:

2

What is the best way to download a pdf file using GWT client ? Should I invoke a normal servlet to do that ? or is there a different preferred approach to handle this problem ?

I am new to GWT, so if some sample code would be of great help.

Thanks Deep

A: 

Try it with GET...

Window.open(GWT.getHostPageBaseURL() + "FileRepository/doDownload?docId=" + dokument.getId(), "", "");
cupakob
Thanks. using this method, can I access any file which is not in the WAR root directory ?
DG
yes, our PDFs are not in war root dir.
cupakob
A: 

the best way is to navigate your browser to that file

on dowload button add click handler

Button downlodButton= new Button("Download"); downlodButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            Window.open("url_of_file", "download File", "");

        }
    });
sagar