Apples
Apples

Reputation: 337

GWT request to download file

I know it's not possible to send an ajax request or use GWT's RequestBuidler to send a request for a file download; needing a form to do it but how do I get a reference to the response when it returns with lets say an error.

The request i send is for a file download but if the file download is too big the Java servlet responds with an error, how do i get a reference to this error to handle it appropriately on the GWT side.

Upvotes: 3

Views: 2079

Answers (2)

Isaac Truett
Isaac Truett

Reputation: 8884

You can add a FormPanel.SubmitCompleteHandler to the form and parse the results in onSubmitComplete().

Upvotes: 1

Frederic Conrotte
Frederic Conrotte

Reputation: 744

With extGWT you can parse the HTML response to know the HTML error code

For instance

    com.extjs.gxt.ui.client.widget.Component.addListener(Events.Submit, new Listener<FormEvent>()
    {
        public void handleEvent(final FormEvent event)
        {
            String htmlResponse = event.getResultHtml();

            (...)
        }
    });

Upvotes: 1

Related Questions