Wednesday, October 16, 2013

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

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();  }

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment