具有大文件的GWT ExternalTextResource
我正在尝试使用ExternalTextResource异步获取一个大型html文件:具有大文件的GWT ExternalTextResource,gwt,resources,Gwt,Resources,我正在尝试使用ExternalTextResource异步获取一个大型html文件: public interface MyHtmlResources extends ClientBundle { public static final MyHtmlResources INSTANCE = GWT.create(MyHtmlResources.class); @Source("some.html") public ExternalTextResource getSom
public interface MyHtmlResources extends ClientBundle {
public static final MyHtmlResources INSTANCE = GWT.create(MyHtmlResources.class);
@Source("some.html")
public ExternalTextResource getSomeHtml();
}
MyHtmlResources.INSTANCE.getSomeHtml().getText(new ResourceCallback<TextResource>() {
public void onError(ResourceException e) { Window.alert(e.toString()); }
public void onSuccess(TextResource r) {
html.setHTML(r.getText());
}
});
公共接口MyHtmlResources扩展了ClientBundle{
公共静态最终MyHtmlResources实例=GWT.create(MyHtmlResources.class);
@来源(“some.html”)
公共外部文本资源getSomeHtml();
}
MyHtmlResources.INSTANCE.getSomeHtml().getText(新资源回调(){
public void onError(ResourceException e){Window.alert(e.toString());}
成功时公共无效(textr资源){
setHTML(r.getText());
}
});
在Firefox上,onError方法始终运行时会显示一条消息:eval()返回null
,而在Chrome上,我得到未捕获的范围错误:超过了最大调用堆栈大小
你知道有没有处理大文件的方法吗?是否限制每个浏览器的最大调用堆栈大小
谢谢
我的“解决方案”是使用italo发布的问题中提到的RequestBuilder。似乎GWT解析文件内容,当文件较大时,它在某些浏览器中失败。看看这个问题:多大才算大?你能把这些文件分成小块吗?你真的需要浏览器中的所有文本吗?“大”需要量化,而且为什么没有“IE”:DI不能拆分,大的是~30MB。