繁体   English   中英

gwt requestbuilder尝试使用Eclipse Jetty访问xml文件时返回404 NOT_FOUND错误

[英]gwt requestbuilder returns 404 NOT_FOUND error while trying to access xml-file with eclipse jetty

iam使用gwt2.4,iam尝试使用gwt requestbuilder访问一个简单的xml文件。 iam使用eclipse和嵌入式码头服务器。

项目结构:

myfooApp战争person.xml

和iam使用地点和活动。

我不知道为什么,但是当我尝试访问xml文件时出现404错误。

它是标准的requestbuilder代码。

RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, GWT.getModuleBaseURL()+"/person.xml");
try{
    builder.sendRequest(null, new RequestCallback() {
        public void onResponseReceived(Request request, Response response) {
            view.getLabel().setText(response.getText());
        }

        public void onError(Request request, Throwable exception) {
            view.getLabel().setText("There was an error! "+exception.getMessage());
        }
    });
}catch(RequestException e){
    view.getLabel().setText("Unable to build the request.");
}

我不确定这是否与问题有关,但GWT.getModuleBaseURL返回:127.0.0。 1:88 88 / myFooApp

但正确的网址是:12 7.0.0.1:8888/myFooApp.html?gwt.codesvr=127.0.0.1:9 997#FileDisplayPlace:side2

这个问题可能是什么原因? 以及如何解决。 非常感谢您的帮助。

GWT.getModuleBaseURL()返回GWT生成文件的文件夹(* .nocache.js和.cache。文件所在的位置)。

如果person.xml是HTML宿主页(myFooApp.html)的同级,则使用GWT.getHostPageBaseURL() 在您的情况下,它将为http://127.0.0.1:8888

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM