Using JsonpRequestBuilder to download a file hosted on a different domain using a ftp link

71 views
Skip to first unread message

Fanny Wong

unread,
Oct 17, 2013, 2:46:43 AM10/17/13
to google-we...@googlegroups.com
Hi everyone, I just started using GWT a couple days ago, and currently trying to download an Excel file from a different domain onto the GWT servers and then parse it later on. I seen suggestions on doing it through Request builder and RPCs but so far haven't gotten any of them to work. Also I have read about the same origin policy and hence resorted to using JsonpRequestBuilder. However, I'm not too sure what I'm missing here, because I keep getting a Time out exception every time I try to access the file. Any guidance and help would be much appreciated :) Thanks.

Error:

SEVERE: com.google.gwt.jsonp.client.TimeoutException: Timeout while calling ftp://webftp.vancouver.ca/OpenData/xls/new_food_vendor_locations.xls


private final String url = "ftp://webftp.vancouver.ca/OpenData/xls/new_food_vendor_locations.xls";

private Logger logger = Logger.getLogger("DataRequest.java");

public void retrieveFile() {
    JsonpRequestBuilder builder = new JsonpRequestBuilder();

    builder.requestObject(url,
            new AsyncCallback<ExcelFileJavascriptObject>() {

                @Override
                public void onFailure(Throwable caught) {
                    // TODO Auto-generated method stub
                    logger.severe(caught.getMessage());
                    logger.severe(caught.toString());
                }

                @Override
                public void onSuccess(ExcelFileJavascriptObject result) {
                    // TODO Auto-generated method stub
                    Window.alert(result.toString());
                }
            });
}

public void onModuleLoad() {
    retrieveFile();
}

Thomas Broyer

unread,
Oct 17, 2013, 8:48:28 AM10/17/13
to google-we...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages